M7350/kernel/Documentation/devicetree/bindings/arm/msm/memory-reserve.txt

89 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-09-09 08:52:07 +00:00
* Memory reservations for MSM targets
Large contiguous allocations (generally sizes greater than 64KB) must be
allocated from a carved out memory pool. The size of the carved out pools
is based on the sizes drivers need. To properly size the pools, devices
must specify the size and type of the memory needed. Any driver wanting to
allocate contiguous memory should indicate this via device tree bindings:
Required parameters:
- qcom,memory-reservation-type: type of memory to be reserved. This is a
string defined in arch/arm/mach-msm/memory.c
- qcom,memory-reservation-size: size of memory to be reserved
Example:
qcom,a-driver {
compatible = "qcom,a-driver";
qcom,memory-reservation-type = "EBI1" /* reserve EBI memory */
qcom,memory-reservation-size = <0x400000>; /* size 4MB */
};
Under some circumstances, it may be necessary to remove a chunk of memory
from the kernel completely using memblock remove. Note this is different
than adjusting the memory tags passed in via the bootloader as the virtual
range is not affected. Any driver needing to remove a block of memory should
add the appropriate binding:
Required parameters:
- qcom,memblock-remove: base and size of block to be removed
qcom,a-driver {
compatible = "qcom,a-driver";
/* Remove 4MB at 0x200000*/
qcom,memblock-remove = <0x200000 0x400000>;
};
In order to ensure memory is only reserved when a driver is actually enabled,
drivers are required to add EXPORT_COMPAT(<name of compatible string>) some
where in the driver. For the examples above, the driver must add
EXPORT_COMPAT("qcom,a-driver") to the driver, similar to EXPORT_SYMBOL.
The EXPORT_COMPAT is to ensure that memory is only carved out if the
driver is actually enabled, otherwise the memory will not be used.
If a reservation is needed that isn't associated directly with any one
driver, the compatible string "qcom,msm-contig-mem" can be used. For
example:
qcom,msm-contig-mem {
compatible = "qcom,msm-contig-mem";
qcom,memory-reservation-type = "EBI1";
qcom,memory-reservation-size = <0x280000>; /* 2.5M EBI1 buffer */
};
In order to specify the size and address of the fixed memory which has
previously been removed the memory-fixed binding can be used. This assumes
that the region has been removed by a separate memblock-remove property
present in the device tree.
Required parameters:
-qcom,memory-fixed: base and size of the fixed memory region
qcom,a-driver {
compatible = "qcom,a-driver";
/* Fixed Memory region of 4MB at 0x200000*/
qcom,memory-fixed = <0x200000 0x400000>;
};
This region is assumed to be a part of a separate hole that has been removed
and this binding specifies the fixed location and size of the region within
that hole.
Some drivers may only wish to reserve memory from the system. Reserved memory
is still tracked internally by the Linux page allocator. The memory is reserved
from the buddy allocator at bootup but may be freed back at a later point in
time with memblock_free and free_bootmem_late.
Required parameters:
-qcom,memblock-reserve: base and size of block to be reserved. Drivers should
call memblock_is_reserved before attempting to use the base address to ensure
the memory was completely reserved.
qcom,a-driver {
compatible = "qcom,a-driver";
/* reserve a 4MB region @ 0x200000 for use later */
qcom,memblock-reserve = <0x200000 0x400000>;
};