18c2ecf20Sopenharmony_ci*** Reserved memory regions *** 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ciReserved memory is specified as a node under the /reserved-memory node. 48c2ecf20Sopenharmony_ciThe operating system shall exclude reserved memory from normal usage 58c2ecf20Sopenharmony_cione can create child nodes describing particular reserved (excluded from 68c2ecf20Sopenharmony_cinormal use) memory regions. Such memory regions are usually designed for 78c2ecf20Sopenharmony_cithe special usage by various device drivers. 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciParameters for each memory region can be encoded into the device tree 108c2ecf20Sopenharmony_ciwith the following nodes: 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/reserved-memory node 138c2ecf20Sopenharmony_ci--------------------- 148c2ecf20Sopenharmony_ci#address-cells, #size-cells (required) - standard definition 158c2ecf20Sopenharmony_ci - Should use the same values as the root node 168c2ecf20Sopenharmony_ciranges (required) - standard definition 178c2ecf20Sopenharmony_ci - Should be empty 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/reserved-memory/ child nodes 208c2ecf20Sopenharmony_ci----------------------------- 218c2ecf20Sopenharmony_ciEach child of the reserved-memory node specifies one or more regions of 228c2ecf20Sopenharmony_cireserved memory. Each child node may either use a 'reg' property to 238c2ecf20Sopenharmony_cispecify a specific range of reserved memory, or a 'size' property with 248c2ecf20Sopenharmony_cioptional constraints to request a dynamically allocated block of memory. 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciFollowing the generic-names recommended practice, node names should 278c2ecf20Sopenharmony_cireflect the purpose of the node (ie. "framebuffer" or "dma-pool"). Unit 288c2ecf20Sopenharmony_ciaddress (@<address>) should be appended to the name if the node is a 298c2ecf20Sopenharmony_cistatic allocation. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciProperties: 328c2ecf20Sopenharmony_ciRequires either a) or b) below. 338c2ecf20Sopenharmony_cia) static allocation 348c2ecf20Sopenharmony_ci reg (required) - standard definition 358c2ecf20Sopenharmony_cib) dynamic allocation 368c2ecf20Sopenharmony_ci size (required) - length based on parent's #size-cells 378c2ecf20Sopenharmony_ci - Size in bytes of memory to reserve. 388c2ecf20Sopenharmony_ci alignment (optional) - length based on parent's #size-cells 398c2ecf20Sopenharmony_ci - Address boundary for alignment of allocation. 408c2ecf20Sopenharmony_ci alloc-ranges (optional) - prop-encoded-array (address, length pairs). 418c2ecf20Sopenharmony_ci - Specifies regions of memory that are 428c2ecf20Sopenharmony_ci acceptable to allocate from. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciIf both reg and size are present, then the reg property takes precedence 458c2ecf20Sopenharmony_ciand size is ignored. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciAdditional properties: 488c2ecf20Sopenharmony_cicompatible (optional) - standard definition 498c2ecf20Sopenharmony_ci - may contain the following strings: 508c2ecf20Sopenharmony_ci - shared-dma-pool: This indicates a region of memory meant to be 518c2ecf20Sopenharmony_ci used as a shared pool of DMA buffers for a set of devices. It can 528c2ecf20Sopenharmony_ci be used by an operating system to instantiate the necessary pool 538c2ecf20Sopenharmony_ci management subsystem if necessary. 548c2ecf20Sopenharmony_ci - vendor specific string in the form <vendor>,[<device>-]<usage> 558c2ecf20Sopenharmony_cino-map (optional) - empty property 568c2ecf20Sopenharmony_ci - Indicates the operating system must not create a virtual mapping 578c2ecf20Sopenharmony_ci of the region as part of its standard mapping of system memory, 588c2ecf20Sopenharmony_ci nor permit speculative access to it under any circumstances other 598c2ecf20Sopenharmony_ci than under the control of the device driver using the region. 608c2ecf20Sopenharmony_cireusable (optional) - empty property 618c2ecf20Sopenharmony_ci - The operating system can use the memory in this region with the 628c2ecf20Sopenharmony_ci limitation that the device driver(s) owning the region need to be 638c2ecf20Sopenharmony_ci able to reclaim it back. Typically that means that the operating 648c2ecf20Sopenharmony_ci system can use that region to store volatile or cached data that 658c2ecf20Sopenharmony_ci can be otherwise regenerated or migrated elsewhere. 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciA node must not carry both the no-map and the reusable property as these are 688c2ecf20Sopenharmony_cilogically contradictory. 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ciLinux implementation note: 718c2ecf20Sopenharmony_ci- If a "linux,cma-default" property is present, then Linux will use the 728c2ecf20Sopenharmony_ci region for the default pool of the contiguous memory allocator. 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci- If a "linux,dma-default" property is present, then Linux will use the 758c2ecf20Sopenharmony_ci region for the default pool of the consistent DMA allocator. 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ciDevice node references to reserved memory 788c2ecf20Sopenharmony_ci----------------------------------------- 798c2ecf20Sopenharmony_ciRegions in the /reserved-memory node may be referenced by other device 808c2ecf20Sopenharmony_cinodes by adding a memory-region property to the device node. 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cimemory-region (optional) - phandle, specifier pairs to children of /reserved-memory 838c2ecf20Sopenharmony_cimemory-region-names (optional) - a list of names, one for each corresponding 848c2ecf20Sopenharmony_ci entry in the memory-region property 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciExample 878c2ecf20Sopenharmony_ci------- 888c2ecf20Sopenharmony_ciThis example defines 3 contiguous regions are defined for Linux kernel: 898c2ecf20Sopenharmony_cione default of all device drivers (named linux,cma@72000000 and 64MiB in size), 908c2ecf20Sopenharmony_cione dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and 918c2ecf20Sopenharmony_cione for multimedia processing (named multimedia-memory@77000000, 64MiB). 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci/ { 948c2ecf20Sopenharmony_ci #address-cells = <1>; 958c2ecf20Sopenharmony_ci #size-cells = <1>; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci memory { 988c2ecf20Sopenharmony_ci reg = <0x40000000 0x40000000>; 998c2ecf20Sopenharmony_ci }; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci reserved-memory { 1028c2ecf20Sopenharmony_ci #address-cells = <1>; 1038c2ecf20Sopenharmony_ci #size-cells = <1>; 1048c2ecf20Sopenharmony_ci ranges; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci /* global autoconfigured region for contiguous allocations */ 1078c2ecf20Sopenharmony_ci linux,cma { 1088c2ecf20Sopenharmony_ci compatible = "shared-dma-pool"; 1098c2ecf20Sopenharmony_ci reusable; 1108c2ecf20Sopenharmony_ci size = <0x4000000>; 1118c2ecf20Sopenharmony_ci alignment = <0x2000>; 1128c2ecf20Sopenharmony_ci linux,cma-default; 1138c2ecf20Sopenharmony_ci }; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci display_reserved: framebuffer@78000000 { 1168c2ecf20Sopenharmony_ci reg = <0x78000000 0x800000>; 1178c2ecf20Sopenharmony_ci }; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci multimedia_reserved: multimedia@77000000 { 1208c2ecf20Sopenharmony_ci compatible = "acme,multimedia-memory"; 1218c2ecf20Sopenharmony_ci reg = <0x77000000 0x4000000>; 1228c2ecf20Sopenharmony_ci }; 1238c2ecf20Sopenharmony_ci }; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci /* ... */ 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci fb0: video@12300000 { 1288c2ecf20Sopenharmony_ci memory-region = <&display_reserved>; 1298c2ecf20Sopenharmony_ci /* ... */ 1308c2ecf20Sopenharmony_ci }; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci scaler: scaler@12500000 { 1338c2ecf20Sopenharmony_ci memory-region = <&multimedia_reserved>; 1348c2ecf20Sopenharmony_ci /* ... */ 1358c2ecf20Sopenharmony_ci }; 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci codec: codec@12600000 { 1388c2ecf20Sopenharmony_ci memory-region = <&multimedia_reserved>; 1398c2ecf20Sopenharmony_ci /* ... */ 1408c2ecf20Sopenharmony_ci }; 1418c2ecf20Sopenharmony_ci}; 142