2 * Copyright(c) 2017 IBM Corporation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 #include <linux/string.h>
15 #include <linux/export.h>
16 #include <linux/uaccess.h>
18 #include <asm/cacheflush.h>
21 * CONFIG_ARCH_HAS_PMEM_API symbols
23 void arch_wb_cache_pmem(void *addr
, size_t size
)
25 unsigned long start
= (unsigned long) addr
;
26 flush_inval_dcache_range(start
, start
+ size
);
28 EXPORT_SYMBOL(arch_wb_cache_pmem
);
30 void arch_invalidate_pmem(void *addr
, size_t size
)
32 unsigned long start
= (unsigned long) addr
;
33 flush_inval_dcache_range(start
, start
+ size
);
35 EXPORT_SYMBOL(arch_invalidate_pmem
);
38 * CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE symbols
40 long __copy_from_user_flushcache(void *dest
, const void __user
*src
,
43 unsigned long copied
, start
= (unsigned long) dest
;
45 copied
= __copy_from_user(dest
, src
, size
);
46 flush_inval_dcache_range(start
, start
+ size
);
51 void *memcpy_flushcache(void *dest
, const void *src
, size_t size
)
53 unsigned long start
= (unsigned long) dest
;
55 memcpy(dest
, src
, size
);
56 flush_inval_dcache_range(start
, start
+ size
);
60 EXPORT_SYMBOL(memcpy_flushcache
);
62 void memcpy_page_flushcache(char *to
, struct page
*page
, size_t offset
,
65 memcpy_flushcache(to
, page_to_virt(page
) + offset
, len
);
67 EXPORT_SYMBOL(memcpy_page_flushcache
);