hw: catch all cache lines for mis-aligned addresses

Fix genodelabs/genode#4905
This commit is contained in:
Stefan Kalkowski 2023-05-24 13:44:08 +02:00 committed by Christian Helmuth
parent 6b2338257d
commit 0aef0959d5
3 changed files with 5 additions and 8 deletions

View File

@ -115,12 +115,7 @@ static inline void cache_maintainance(addr_t const base,
size_t const cache_line_size,
FUNC & func)
{
/**
* Although, the ARMv7 reference manual states that addresses does not
* need to be cacheline aligned, we observed problems when not doing so
* on i.MX6 Quad Sabrelite (maybe Cortex A9 generic issue?).
* Therefore, we align it here.
*/
/* align the start address to catch all related cache lines */
addr_t start = base & ~(cache_line_size-1);
addr_t const end = base + size;

View File

@ -95,7 +95,8 @@ static inline void cache_maintainance(addr_t const base,
size_t const size,
FUNC & func)
{
addr_t start = (addr_t) base;
/* align the start address to catch all related cache lines */
addr_t start = (addr_t)base & ~(Cpu::cache_line_size()-1UL);
addr_t const end = base + size;
for (; start < end; start += Cpu::cache_line_size()) func(start);
}

View File

@ -45,7 +45,8 @@ static inline void for_each_cache_line(Genode::addr_t addr,
static size_t cache_line_size = Kernel::cache_line_size();
addr_t start = addr;
/* align the start address to catch all related cache lines */
addr_t start = addr & ~(cache_line_size-1);
addr_t const end = addr + size;
for (; start < end; start += cache_line_size)
fn(start);