mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
x86, libnvdimm, pmem: move arch_invalidate_pmem() to libnvdimm
Kill this globally defined wrapper and move to libnvdimm so that we can ultimately remove include/linux/pmem.h and asm/pmem.h. Cc: <x86@kernel.org> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
4e4f00a9b5
commit
f2b612578e
@ -43,10 +43,5 @@ static inline void arch_memcpy_to_pmem(void *dst, const void *src, size_t n)
|
||||
__func__, dst, src, rem))
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void arch_invalidate_pmem(void *addr, size_t size)
|
||||
{
|
||||
clflush_cache_range(addr, size);
|
||||
}
|
||||
#endif /* CONFIG_ARCH_HAS_PMEM_API */
|
||||
#endif /* __ASM_X86_PMEM_H__ */
|
||||
|
@ -150,6 +150,12 @@ void clflush_cache_range(void *vaddr, unsigned int size)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clflush_cache_range);
|
||||
|
||||
void arch_invalidate_pmem(void *addr, size_t size)
|
||||
{
|
||||
clflush_cache_range(addr, size);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
|
||||
|
||||
static void __cpa_flush_all(void *arg)
|
||||
{
|
||||
unsigned long cache = (unsigned long)arg;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/pmem.h>
|
||||
#include "nd-core.h"
|
||||
#include "pmem.h"
|
||||
#include "pfn.h"
|
||||
#include "btt.h"
|
||||
#include "nd.h"
|
||||
@ -272,7 +273,7 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
|
||||
cleared /= 512;
|
||||
badblocks_clear(&nsio->bb, sector, cleared);
|
||||
}
|
||||
invalidate_pmem(nsio->addr + offset, size);
|
||||
arch_invalidate_pmem(nsio->addr + offset, size);
|
||||
} else
|
||||
rc = -EIO;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ static int pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset,
|
||||
badblocks_clear(&pmem->bb, sector, cleared);
|
||||
}
|
||||
|
||||
invalidate_pmem(pmem->virt_addr + offset, len);
|
||||
arch_invalidate_pmem(pmem->virt_addr + offset, len);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -7,10 +7,14 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_PMEM_API
|
||||
void arch_wb_cache_pmem(void *addr, size_t size);
|
||||
void arch_invalidate_pmem(void *addr, size_t size);
|
||||
#else
|
||||
static inline void arch_wb_cache_pmem(void *addr, size_t size)
|
||||
{
|
||||
}
|
||||
static inline void arch_invalidate_pmem(void *addr, size_t size)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* this definition is in it's own header for tools/testing/nvdimm to consume */
|
||||
|
@ -30,11 +30,6 @@ static inline void arch_memcpy_to_pmem(void *dst, const void *src, size_t n)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void arch_invalidate_pmem(void *addr, size_t size)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool arch_has_pmem_api(void)
|
||||
@ -61,18 +56,4 @@ static inline void memcpy_to_pmem(void *dst, const void *src, size_t n)
|
||||
else
|
||||
memcpy(dst, src, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* invalidate_pmem - flush a pmem range from the cache hierarchy
|
||||
* @addr: virtual start address
|
||||
* @size: bytes to invalidate (internally aligned to cache line size)
|
||||
*
|
||||
* For platforms that support clearing poison this flushes any poisoned
|
||||
* ranges out of the cache
|
||||
*/
|
||||
static inline void invalidate_pmem(void *addr, size_t size)
|
||||
{
|
||||
if (arch_has_pmem_api())
|
||||
arch_invalidate_pmem(addr, size);
|
||||
}
|
||||
#endif /* __PMEM_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user