mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
codec_mm: scatter sys alloc flag config conditionally. [1/1]
PD#SWPL-113445 Problem: t5m dos should not access ddr1. codec_mm cma is not enough. for some cases. Solution: when ddr0 is limited to DMA32_ZONE, scatter could be alloced from DMA32_ZONE when configuration is set. Verify: T963D4 Change-Id: Ibb93676dfa403f1ac789f8d03c92ab9369708d61 Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
This commit is contained in:
committed by
gerrit autosubmit
parent
f4627412d7
commit
868b72dd1d
@@ -2725,7 +2725,7 @@ EXPORT_SYMBOL(codec_mm_get_total_size);
|
||||
int codec_mm_get_free_size(void)
|
||||
{
|
||||
struct codec_mm_mgt_s *mgt = get_mem_mgt();
|
||||
if (debug_mode & 0x20)
|
||||
if (debug_mode & 0x40)
|
||||
dump_mem_infos(NULL, 0);
|
||||
return codec_mm_get_total_size() -
|
||||
mgt->tvp_pool.total_size + mgt->tvp_pool.alloced_size -
|
||||
|
||||
@@ -111,6 +111,9 @@
|
||||
((c) << 8) | (d))
|
||||
#define SMGT_IDENTIFY_TAG MK_TAG('Z', 'S', 'C', 'Z')
|
||||
|
||||
/* config_alloc_flags bitmask */
|
||||
#define SC_ALLOC_SYS_DMA32 BIT(0)
|
||||
|
||||
struct codec_mm_scatter_s {
|
||||
u32 keep_size_PAGE;
|
||||
u32 reserved_block_mm_M;
|
||||
@@ -121,6 +124,7 @@ struct codec_mm_scatter_s {
|
||||
u32 no_cache_size_M;
|
||||
u32 support_from_slot_sys;
|
||||
u32 no_alloc_from_sys;
|
||||
u32 config_alloc_flags;
|
||||
};
|
||||
|
||||
struct codec_mm_scatter_mgt {
|
||||
@@ -139,6 +143,7 @@ struct codec_mm_scatter_mgt {
|
||||
u32 enable_slot_from_sys;
|
||||
u32 no_cache_size_M;
|
||||
u32 no_alloc_from_sys;
|
||||
u32 config_alloc_flags;
|
||||
u32 support_from_slot_sys;
|
||||
int one_page_cnt;
|
||||
int scatters_cnt;
|
||||
@@ -704,8 +709,13 @@ codec_mm_slot_alloc(struct codec_mm_scatter_mgt *smgt, int size, int flags)
|
||||
/*try alloc from sys. */
|
||||
int page_order = get_order(try_alloc_size);
|
||||
|
||||
slot->page_header = __get_free_pages(__GFP_IO | __GFP_NOWARN |
|
||||
__GFP_NORETRY, page_order);
|
||||
if (smgt->config_alloc_flags & SC_ALLOC_SYS_DMA32) {
|
||||
slot->page_header = __get_free_pages(__GFP_IO | __GFP_NOWARN |
|
||||
__GFP_NORETRY | GFP_DMA32, page_order);
|
||||
} else {
|
||||
slot->page_header = __get_free_pages(__GFP_IO | __GFP_NOWARN |
|
||||
__GFP_NORETRY, page_order);
|
||||
}
|
||||
if (!slot->page_header) {
|
||||
if ((try_alloc_size >> (PAGE_SHIFT + 1)) >=
|
||||
smgt->try_alloc_in_sys_page_cnt_min) {
|
||||
@@ -894,10 +904,15 @@ static int codec_mm_page_alloc_from_one_pages(struct codec_mm_scatter_mgt *smgt,
|
||||
int alloced = 0;
|
||||
|
||||
while (neednum > 0) { /*one page alloc */
|
||||
void *vpage = (void *)__get_free_page(GFP_KERNEL);
|
||||
void *vpage;
|
||||
ulong page;
|
||||
page_sid_type sid;
|
||||
|
||||
if (smgt->config_alloc_flags & SC_ALLOC_SYS_DMA32) {
|
||||
vpage = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
|
||||
} else {
|
||||
vpage = (void *)__get_free_page(GFP_KERNEL);
|
||||
}
|
||||
if (vpage) {
|
||||
page = virt_to_phys(vpage);
|
||||
sid = ONE_PAGE_SID;
|
||||
@@ -2342,6 +2357,8 @@ int codec_mm_scatter_update_config(struct codec_mm_scatter_mgt *smgt)
|
||||
smgt->support_from_slot_sys = g_scatter.support_from_slot_sys;
|
||||
smgt->no_cache_size_M = g_scatter.no_cache_size_M;
|
||||
smgt->no_alloc_from_sys = g_scatter.no_alloc_from_sys;
|
||||
smgt->config_alloc_flags = g_scatter.config_alloc_flags;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2779,6 +2796,7 @@ static struct mconfig codec_mm_sc_configs[] = {
|
||||
&g_scatter.enable_slot_from_sys),
|
||||
MC_PU32("no_cache_size_M", &g_scatter.no_cache_size_M),
|
||||
MC_PU32("no_alloc_from_sys", &g_scatter.no_alloc_from_sys),
|
||||
MC_PU32("config_alloc_flags", &g_scatter.config_alloc_flags),
|
||||
};
|
||||
|
||||
static struct mconfig_node codec_mm_sc;
|
||||
@@ -2803,6 +2821,7 @@ int codec_mm_scatter_mgt_init(struct device *dev)
|
||||
g_scatter.support_from_slot_sys = smgt->support_from_slot_sys;
|
||||
g_scatter.no_cache_size_M = smgt->no_cache_size_M;
|
||||
g_scatter.no_alloc_from_sys = 0;
|
||||
g_scatter.config_alloc_flags = 0;
|
||||
|
||||
smgt->dev = dev;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user