iommu/vt-d: Populate debugfs if IOMMUs are detected
[linux/fpc-iii.git] / arch / powerpc / lib / pmem.c
blob0666a8d2959622208aaf36ad45f9777dfbdc1ed1
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright(c) 2017 IBM Corporation. All rights reserved.
4 */
6 #include <linux/string.h>
7 #include <linux/export.h>
8 #include <linux/uaccess.h>
10 #include <asm/cacheflush.h>
13 * CONFIG_ARCH_HAS_PMEM_API symbols
15 void arch_wb_cache_pmem(void *addr, size_t size)
17 unsigned long start = (unsigned long) addr;
18 flush_dcache_range(start, start + size);
20 EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);
22 void arch_invalidate_pmem(void *addr, size_t size)
24 unsigned long start = (unsigned long) addr;
25 flush_dcache_range(start, start + size);
27 EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
30 * CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE symbols
32 long __copy_from_user_flushcache(void *dest, const void __user *src,
33 unsigned size)
35 unsigned long copied, start = (unsigned long) dest;
37 copied = __copy_from_user(dest, src, size);
38 flush_dcache_range(start, start + size);
40 return copied;
43 void *memcpy_flushcache(void *dest, const void *src, size_t size)
45 unsigned long start = (unsigned long) dest;
47 memcpy(dest, src, size);
48 flush_dcache_range(start, start + size);
50 return dest;
52 EXPORT_SYMBOL(memcpy_flushcache);
54 void memcpy_page_flushcache(char *to, struct page *page, size_t offset,
55 size_t len)
57 memcpy_flushcache(to, page_to_virt(page) + offset, len);
59 EXPORT_SYMBOL(memcpy_page_flushcache);