1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2022 Ventana Micro Systems Inc.
6 #include <linux/export.h>
7 #include <linux/libnvdimm.h>
9 #include <asm/cacheflush.h>
10 #include <asm/dma-noncoherent.h>
12 void arch_wb_cache_pmem(void *addr
, size_t size
)
14 #ifdef CONFIG_RISCV_NONSTANDARD_CACHE_OPS
15 if (unlikely(noncoherent_cache_ops
.wback
)) {
16 noncoherent_cache_ops
.wback(virt_to_phys(addr
), size
);
20 ALT_CMO_OP(CLEAN
, addr
, size
, riscv_cbom_block_size
);
22 EXPORT_SYMBOL_GPL(arch_wb_cache_pmem
);
24 void arch_invalidate_pmem(void *addr
, size_t size
)
26 #ifdef CONFIG_RISCV_NONSTANDARD_CACHE_OPS
27 if (unlikely(noncoherent_cache_ops
.inv
)) {
28 noncoherent_cache_ops
.inv(virt_to_phys(addr
), size
);
32 ALT_CMO_OP(INVAL
, addr
, size
, riscv_cbom_block_size
);
34 EXPORT_SYMBOL_GPL(arch_invalidate_pmem
);