Skip to content

Commit 946bb33

Browse files
Christoph Hellwigpalmer-dabbelt
authored andcommitted
riscv: split cache ops out of dma-noncoherent.c
The cache ops are also used by the pmem code which is unconditionally built into the kernel. Move them into a separate file that is built based on the correct config option. Fixes: fd96278 ("riscv: RISCV_NONSTANDARD_CACHE_OPS shouldn't depend on RISCV_DMA_NONCOHERENT") Reported-by: kernel test robot <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Tested-by: Conor Dooley <[email protected]> Reviewed-by: Lad Prabhakar <[email protected]> Tested-by: Lad Prabhakar <[email protected]> # Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent f367db7 commit 946bb33

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

arch/riscv/mm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ endif
3636

3737
obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o
3838
obj-$(CONFIG_RISCV_DMA_NONCOHERENT) += dma-noncoherent.o
39+
obj-$(CONFIG_RISCV_NONSTANDARD_CACHE_OPS) += cache-ops.o

arch/riscv/mm/cache-ops.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Copyright (c) 2021 Western Digital Corporation or its affiliates.
4+
*/
5+
6+
#include <asm/dma-noncoherent.h>
7+
8+
struct riscv_nonstd_cache_ops noncoherent_cache_ops __ro_after_init;
9+
10+
void
11+
riscv_noncoherent_register_cache_ops(const struct riscv_nonstd_cache_ops *ops)
12+
{
13+
if (!ops)
14+
return;
15+
noncoherent_cache_ops = *ops;
16+
}
17+
EXPORT_SYMBOL_GPL(riscv_noncoherent_register_cache_ops);

arch/riscv/mm/dma-noncoherent.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ static bool noncoherent_supported __ro_after_init;
1515
int dma_cache_alignment __ro_after_init = ARCH_DMA_MINALIGN;
1616
EXPORT_SYMBOL_GPL(dma_cache_alignment);
1717

18-
struct riscv_nonstd_cache_ops noncoherent_cache_ops __ro_after_init = {
19-
.wback = NULL,
20-
.inv = NULL,
21-
.wback_inv = NULL,
22-
};
23-
2418
static inline void arch_dma_cache_wback(phys_addr_t paddr, size_t size)
2519
{
2620
void *vaddr = phys_to_virt(paddr);
@@ -162,12 +156,3 @@ void __init riscv_set_dma_cache_alignment(void)
162156
if (!noncoherent_supported)
163157
dma_cache_alignment = 1;
164158
}
165-
166-
void riscv_noncoherent_register_cache_ops(const struct riscv_nonstd_cache_ops *ops)
167-
{
168-
if (!ops)
169-
return;
170-
171-
noncoherent_cache_ops = *ops;
172-
}
173-
EXPORT_SYMBOL_GPL(riscv_noncoherent_register_cache_ops);

0 commit comments

Comments
 (0)