a49ab905a1
The NVDIMM PMEM driver expects arch specific APIs for cache maintenance and if arch does not provide these APIs then NVDIMM PMEM driver will always use MEMREMAP_WT to map persistent memory which in-turn maps as UC memory type defined by the RISC-V Svpbmt specification. Now that the Svpbmt and Zicbom support is available in RISC-V kernel, we implement PMEM APIs using ALT_CMO_OP() macros so that the NVDIMM PMEM driver can use MEMREMAP_WB to map persistent memory. Co-developed-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20221114090536.1662624-3-apatel@ventanamicro.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
22 lines
477 B
C
22 lines
477 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2022 Ventana Micro Systems Inc.
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/libnvdimm.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
void arch_wb_cache_pmem(void *addr, size_t size)
|
|
{
|
|
ALT_CMO_OP(clean, addr, size, riscv_cbom_block_size);
|
|
}
|
|
EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);
|
|
|
|
void arch_invalidate_pmem(void *addr, size_t size)
|
|
{
|
|
ALT_CMO_OP(inval, addr, size, riscv_cbom_block_size);
|
|
}
|
|
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
|