Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Based on arch/arm/mm/copypage.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2002 Deep Blue Solutions Ltd, All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2012 ARM Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/bitops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/cpufeature.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/mte.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void copy_highpage(struct page *to, struct page *from)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	struct page *kto = page_address(to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct page *kfrom = page_address(from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	copy_page(kto, kfrom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	if (system_supports_mte() && test_bit(PG_mte_tagged, &from->flags)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		set_bit(PG_mte_tagged, &to->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		page_kasan_tag_reset(to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		 * We need smp_wmb() in between setting the flags and clearing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		 * tags because if another thread reads page->flags and builds a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		 * tagged address out of it, there is an actual dependency to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		 * memory access, but on the current thread we do not guarantee that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		 * the new page->flags are visible before the tags were updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		smp_wmb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		mte_copy_page_tags(kto, kfrom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) EXPORT_SYMBOL(copy_highpage);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void copy_user_highpage(struct page *to, struct page *from,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 			unsigned long vaddr, struct vm_area_struct *vma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	copy_highpage(to, from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	flush_dcache_page(to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) EXPORT_SYMBOL_GPL(copy_user_highpage);