ANDROID: integrate GCMA with CMA using dt-bindings

This patch introduces a new "guarantee" property for shared-dma-pool.
With the property, admin can create specific memory pool as
GCMA-based-CMA if they care about allocation success rate and latency
without reserving a dedicated memory area.

Bug: 236887352
Bug: 270089503
Bug: 391879760
Change-Id: I3a019f889f7ffa4d2255609c19b15078b9c5b6a4
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan
2025-02-28 11:16:51 -08:00
committed by Carlos Llamas
parent 80a603a57a
commit 0dad457899
6 changed files with 49 additions and 11 deletions
+10 -1
View File
@@ -465,6 +465,7 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
unsigned long node = rmem->fdt_node;
bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL);
struct cma *cma;
bool gcma;
int err;
if (size_cmdline != -1 && default_cma) {
@@ -482,7 +483,15 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
return -EINVAL;
}
err = cma_init_reserved_mem(rmem->base, rmem->size, 0, rmem->name, &cma);
gcma = !!of_get_flat_dt_prop(node, "guarantee", NULL);
#ifndef CONFIG_GCMA
if (gcma) {
pr_err("Reserved memory: unable to setup GCMA region, GCMA is not enabled\n");
return -EINVAL;
}
#endif
err = cma_init_reserved_mem(rmem->base, rmem->size, 0, rmem->name,
&cma, gcma);
if (err) {
pr_err("Reserved memory: unable to setup CMA region\n");
return err;