Hi David:
With the continuous development of video and AI technology, device request
lots of continuous physical memory. In some cases, in order to ensure device
obtain continuous physical memory and also aovid debris which create by other
device. Based on the above situation, some device need exclusive a special
named CMA area.
On CMA, the system support multiple named or anonymous CMA areas, and we can
establish CMA area with name on DTS, as follow:
/ {
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
linux,cma {
compatible = "shared-dma-pool";
reusable;
size = <0x00800000>; /* 8M */
alloc-ranges = <0x69000000 0x00800000>;
linux,cma-default;
};
CMA0 { /* Scaler */
compatible = "shared-dma-pool";
reusable;
size = <0x00800000>; /* 8M */
alloc-ranges = <0x6A000000 0x00800000>;
};
CMA1 { /* DECODE */
compatible = "shared-dma-pool";
reusable;
size = <0x00800000>; /* 8M */
alloc-ranges = <0x6B000000 0x00800000>
};
CMA_vpm {
compatible = "shared-dma-pool";
reusable;
size = <0x00800000>; /* 8M */
alloc-ranges = <0x6C000000 0x00800000>;
};
};
}
As shown above, the system will establish 4 CMA area, and all CMA areas is named
CMA area. such as “default"、"CMA0"、"CMA1"、and "CMA_vpm". Some device
must use or exclusive a special CMA area, so device will process as follow:
Device A:
static int XA_probe(struct platform_device *pdev)
{
struct cma *cma;
cma = cma_find_by_name("CMA_vpm");
if (cma) {
pdev->dev.cma_area = cma;
}
.....
}