drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / arch / riscv / mm / pmem.c
blob370a422ede1101b768f4849e946d6af4fdfc8bd5
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2022 Ventana Micro Systems Inc.
4 */
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);
17 return;
19 #endif
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);
29 return;
31 #endif
32 ALT_CMO_OP(INVAL, addr, size, riscv_cbom_block_size);
34 EXPORT_SYMBOL_GPL(arch_invalidate_pmem);