Skip to content

Commit 1f42faf

Browse files
Fuad Tabbawilldeacon
authored andcommitted
arm64: __clean_dcache_area_poc 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. Because the code is shared with __dma_clean_area, it changes the parameters for that as well. However, __dma_clean_area is local to cache.S, so no other users are affected. 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-14-tabba@google.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 814b186 commit 1f42faf

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

arch/arm64/include/asm/cacheflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extern void __flush_icache_range(unsigned long start, unsigned long end);
6060
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);
63-
extern void __clean_dcache_area_poc(void *addr, size_t len);
63+
extern void __clean_dcache_area_poc(unsigned long start, unsigned long end);
6464
extern void __clean_dcache_area_pop(void *addr, size_t len);
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);

arch/arm64/kernel/efi-entry.S

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ SYM_CODE_START(efi_enter_kernel)
2828
* stale icache entries from before relocation.
2929
*/
3030
ldr w1, =kernel_size
31+
add x1, x0, x1
3132
bl __clean_dcache_area_poc
3233
ic ialluis
3334

@@ -36,7 +37,7 @@ SYM_CODE_START(efi_enter_kernel)
3637
* so that we can safely disable the MMU and caches.
3738
*/
3839
adr x0, 0f
39-
ldr w1, 3f
40+
adr x1, 3f
4041
bl __clean_dcache_area_poc
4142
0:
4243
/* Turn off Dcache and MMU */
@@ -64,5 +65,5 @@ SYM_CODE_START(efi_enter_kernel)
6465
mov x2, xzr
6566
mov x3, xzr
6667
br x19
68+
3:
6769
SYM_CODE_END(efi_enter_kernel)
68-
3: .long . - 0b

arch/arm64/mm/cache.S

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,23 @@ SYM_FUNC_END_PI(__inval_dcache_area)
171171
SYM_FUNC_END(__dma_inv_area)
172172

173173
/*
174-
* __clean_dcache_area_poc(kaddr, size)
174+
* __clean_dcache_area_poc(start, end)
175175
*
176-
* Ensure that any D-cache lines for the interval [kaddr, kaddr+size)
176+
* Ensure that any D-cache lines for the interval [start, end)
177177
* are cleaned to the PoC.
178178
*
179-
* - kaddr - kernel address
180-
* - size - size in question
179+
* - start - virtual start address of region
180+
* - end - virtual end address of region
181181
*/
182182
SYM_FUNC_START_LOCAL(__dma_clean_area)
183183
SYM_FUNC_START_PI(__clean_dcache_area_poc)
184184
/* FALLTHROUGH */
185185

186186
/*
187-
* __dma_clean_area(start, size)
187+
* __dma_clean_area(start, end)
188188
* - start - virtual start address of region
189-
* - size - size in question
189+
* - end - virtual end address of region
190190
*/
191-
add x1, x0, x1
192191
dcache_by_line_op cvac, sy, x0, x1, x2, x3
193192
ret
194193
SYM_FUNC_END_PI(__clean_dcache_area_poc)
@@ -204,10 +203,10 @@ SYM_FUNC_END(__dma_clean_area)
204203
* - size - size in question
205204
*/
206205
SYM_FUNC_START_PI(__clean_dcache_area_pop)
206+
add x1, x0, x1
207207
alternative_if_not ARM64_HAS_DCPOP
208208
b __clean_dcache_area_poc
209209
alternative_else_nop_endif
210-
add x1, x0, x1
211210
dcache_by_line_op cvap, sy, x0, x1, x2, x3
212211
ret
213212
SYM_FUNC_END_PI(__clean_dcache_area_pop)
@@ -236,7 +235,6 @@ SYM_FUNC_START_PI(__dma_map_area)
236235
add x1, x0, x1
237236
cmp w2, #DMA_FROM_DEVICE
238237
b.eq __dma_inv_area
239-
sub x1, x1, x0
240238
b __dma_clean_area
241239
SYM_FUNC_END_PI(__dma_map_area)
242240

0 commit comments

Comments
 (0)