Skip to content

Commit f749448

Browse files
Fuad Tabbawilldeacon
authored andcommitted
arm64: __clean_dcache_area_pop to take end parameter instead of size
To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. No functional change intended. Reported-by: Will Deacon <will@kernel.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Fuad Tabba <tabba@google.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20210524083001.2586635-15-tabba@google.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 1f42faf commit f749448

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

arch/arm64/include/asm/cacheflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extern void invalidate_icache_range(unsigned long start, unsigned long end);
6161
extern void __flush_dcache_area(unsigned long start, unsigned long end);
6262
extern void __inval_dcache_area(unsigned long start, unsigned long end);
6363
extern void __clean_dcache_area_poc(unsigned long start, unsigned long end);
64-
extern void __clean_dcache_area_pop(void *addr, size_t len);
64+
extern void __clean_dcache_area_pop(unsigned long start, unsigned long end);
6565
extern void __clean_dcache_area_pou(void *addr, size_t len);
6666
extern long __flush_cache_user_range(unsigned long start, unsigned long end);
6767
extern void sync_icache_aliases(void *kaddr, unsigned long len);

arch/arm64/lib/uaccess_flushcache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void memcpy_flushcache(void *dst, const void *src, size_t cnt)
1515
* barrier to order the cache maintenance against the memcpy.
1616
*/
1717
memcpy(dst, src, cnt);
18-
__clean_dcache_area_pop(dst, cnt);
18+
__clean_dcache_area_pop((unsigned long)dst, (unsigned long)dst + cnt);
1919
}
2020
EXPORT_SYMBOL_GPL(memcpy_flushcache);
2121

@@ -33,6 +33,6 @@ unsigned long __copy_user_flushcache(void *to, const void __user *from,
3333
rc = raw_copy_from_user(to, from, n);
3434

3535
/* See above */
36-
__clean_dcache_area_pop(to, n - rc);
36+
__clean_dcache_area_pop((unsigned long)to, (unsigned long)to + n - rc);
3737
return rc;
3838
}

arch/arm64/mm/cache.S

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,15 @@ SYM_FUNC_END_PI(__clean_dcache_area_poc)
194194
SYM_FUNC_END(__dma_clean_area)
195195

196196
/*
197-
* __clean_dcache_area_pop(kaddr, size)
197+
* __clean_dcache_area_pop(start, end)
198198
*
199-
* Ensure that any D-cache lines for the interval [kaddr, kaddr+size)
199+
* Ensure that any D-cache lines for the interval [start, end)
200200
* are cleaned to the PoP.
201201
*
202-
* - kaddr - kernel address
203-
* - size - size in question
202+
* - start - virtual start address of region
203+
* - end - virtual end address of region
204204
*/
205205
SYM_FUNC_START_PI(__clean_dcache_area_pop)
206-
add x1, x0, x1
207206
alternative_if_not ARM64_HAS_DCPOP
208207
b __clean_dcache_area_poc
209208
alternative_else_nop_endif

arch/arm64/mm/flush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void arch_wb_cache_pmem(void *addr, size_t size)
8484
{
8585
/* Ensure order against any prior non-cacheable writes */
8686
dmb(osh);
87-
__clean_dcache_area_pop(addr, size);
87+
__clean_dcache_area_pop((unsigned long)addr, (unsigned long)addr + size);
8888
}
8989
EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);
9090

0 commit comments

Comments
 (0)