From: Ma Wupeng mawupeng1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8K5CO
--------------------------------
Introduce copy_mc_highpage for arm64 to support do_mte.
Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- arch/arm64/include/asm/page.h | 1 + arch/arm64/mm/copypage.c | 13 +++++++++++++ include/linux/highmem.h | 2 ++ 3 files changed, 16 insertions(+)
diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h index 4d3ba27b96cb..09b898a3e57c 100644 --- a/arch/arm64/include/asm/page.h +++ b/arch/arm64/include/asm/page.h @@ -31,6 +31,7 @@ void copy_highpage(struct page *to, struct page *from); #ifdef CONFIG_ARCH_HAS_COPY_MC extern void copy_page_mc(void *to, const void *from); void copy_highpage_mc(struct page *to, struct page *from); +int copy_mc_highpage(struct page *to, struct page *from); #define __HAVE_ARCH_COPY_HIGHPAGE_MC
void copy_user_highpage_mc(struct page *to, struct page *from, diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c index 7c1705c5e9d5..0696820d72ab 100644 --- a/arch/arm64/mm/copypage.c +++ b/arch/arm64/mm/copypage.c @@ -61,4 +61,17 @@ void copy_user_highpage_mc(struct page *to, struct page *from, flush_dcache_page(to); } EXPORT_SYMBOL_GPL(copy_user_highpage_mc); + +int copy_mc_highpage(struct page *to, struct page *from) +{ + void *kto = page_address(to); + void *kfrom = page_address(from); + int ret; + + ret = copy_mc_to_kernel(kto, kfrom, PAGE_SIZE); + if (!ret) + do_mte(to, from, kto, kfrom, true); + + return ret; +} #endif diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 366198ebba71..94592d7630f4 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -397,6 +397,7 @@ static inline void memcpy_to_page(struct page *page, size_t offset, }
#ifdef copy_mc_to_kernel +#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE_MC /* * If architecture supports machine check exception handling, define the * #MC versions of copy_user_highpage and copy_highpage. They copy a memory @@ -416,6 +417,7 @@ static inline int copy_mc_highpage(struct page *to, struct page *from)
return ret; } +#endif #else static inline int copy_mc_highpage(struct page *to, struct page *from) {