arch/armv7-ar: flush dcache when addr is not aligned with cache line
When invalidate address is not aligned with cache line, must align address and flush the cache line. Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
parent
4bb155db64
commit
806a2a8b8d
@ -94,16 +94,32 @@ static void cp15_dcache_op_mva(uintptr_t start, uintptr_t end, int op)
|
|||||||
uint32_t line;
|
uint32_t line;
|
||||||
|
|
||||||
line = cp15_cache_get_info(NULL, NULL);
|
line = cp15_cache_get_info(NULL, NULL);
|
||||||
start &= ~(line - 1);
|
|
||||||
|
|
||||||
ARM_DSB();
|
ARM_DSB();
|
||||||
|
|
||||||
|
if ((start & (line - 1)) != 0)
|
||||||
|
{
|
||||||
|
start &= ~(line - 1);
|
||||||
|
if (op == CP15_CACHE_INVALIDATE)
|
||||||
|
{
|
||||||
|
cp15_cleaninvalidate_dcacheline_bymva(start);
|
||||||
|
start += line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (start < end)
|
while (start < end)
|
||||||
{
|
{
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case CP15_CACHE_INVALIDATE:
|
case CP15_CACHE_INVALIDATE:
|
||||||
|
if (start + line <= end)
|
||||||
|
{
|
||||||
cp15_invalidate_dcacheline_bymva(start);
|
cp15_invalidate_dcacheline_bymva(start);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cp15_cleaninvalidate_dcacheline_bymva(start);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CP15_CACHE_CLEAN:
|
case CP15_CACHE_CLEAN:
|
||||||
cp15_clean_dcache_bymva(start);
|
cp15_clean_dcache_bymva(start);
|
||||||
|
@ -94,16 +94,32 @@ static void cp15_dcache_op_mva(uintptr_t start, uintptr_t end, int op)
|
|||||||
uint32_t line;
|
uint32_t line;
|
||||||
|
|
||||||
line = cp15_cache_get_info(NULL, NULL);
|
line = cp15_cache_get_info(NULL, NULL);
|
||||||
start &= ~(line - 1);
|
|
||||||
|
|
||||||
ARM_DSB();
|
ARM_DSB();
|
||||||
|
|
||||||
|
if ((start & (line - 1)) != 0)
|
||||||
|
{
|
||||||
|
start &= ~(line - 1);
|
||||||
|
if (op == CP15_CACHE_INVALIDATE)
|
||||||
|
{
|
||||||
|
cp15_cleaninvalidate_dcacheline_bymva(start);
|
||||||
|
start += line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (start < end)
|
while (start < end)
|
||||||
{
|
{
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case CP15_CACHE_INVALIDATE:
|
case CP15_CACHE_INVALIDATE:
|
||||||
|
if (start + line <= end)
|
||||||
|
{
|
||||||
cp15_invalidate_dcacheline_bymva(start);
|
cp15_invalidate_dcacheline_bymva(start);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cp15_cleaninvalidate_dcacheline_bymva(start);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CP15_CACHE_CLEAN:
|
case CP15_CACHE_CLEAN:
|
||||||
cp15_clean_dcache_bymva(start);
|
cp15_clean_dcache_bymva(start);
|
||||||
|
Loading…
Reference in New Issue
Block a user