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 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* NGpage.S: Niagara optimize clear and copy page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2006 (davem@davemloft.net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <asm/asi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	.text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	.align	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	/* This is heavily simplified from the sun4u variants
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	 * because Niagara does not have any D-cache aliasing issues
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	 * and also we don't need to use the FPU in order to implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	 * an optimal page copy/clear.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) NGcopy_user_page:	/* %o0=dest, %o1=src, %o2=vaddr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	save		%sp, -192, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	rd		%asi, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	set		PAGE_SIZE, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	prefetch	[%i1 + 0x00], #one_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	prefetch	[%i1 + 0x40], #one_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 1:	prefetch	[%i1 + 0x80], #one_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	prefetch	[%i1 + 0xc0], #one_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	ldda		[%i1 + 0x00] %asi, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	ldda		[%i1 + 0x10] %asi, %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	ldda		[%i1 + 0x20] %asi, %l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	ldda		[%i1 + 0x30] %asi, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	stxa		%o2, [%i0 + 0x00] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	stxa		%o3, [%i0 + 0x08] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	stxa		%o4, [%i0 + 0x10] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	stxa		%o5, [%i0 + 0x18] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	stxa		%l2, [%i0 + 0x20] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	stxa		%l3, [%i0 + 0x28] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	stxa		%l4, [%i0 + 0x30] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	stxa		%l5, [%i0 + 0x38] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	ldda		[%i1 + 0x40] %asi, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	ldda		[%i1 + 0x50] %asi, %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	ldda		[%i1 + 0x60] %asi, %l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	ldda		[%i1 + 0x70] %asi, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	stxa		%o2, [%i0 + 0x40] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	stxa		%o3, [%i0 + 0x48] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	stxa		%o4, [%i0 + 0x50] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	stxa		%o5, [%i0 + 0x58] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	stxa		%l2, [%i0 + 0x60] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	stxa		%l3, [%i0 + 0x68] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	stxa		%l4, [%i0 + 0x70] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	stxa		%l5, [%i0 + 0x78] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	add		%i1, 128, %i1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	subcc		%g7, 128, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	bne,pt		%xcc, 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	 add		%i0, 128, %i0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	wr		%g3, 0x0, %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	membar		#Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	 restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	.align		32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	.globl		NGclear_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	.globl		NGclear_user_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) NGclear_page:		/* %o0=dest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) NGclear_user_page:	/* %o0=dest, %o1=vaddr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	rd		%asi, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	set		PAGE_SIZE, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 1:	stxa		%g0, [%o0 + 0x00] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	stxa		%g0, [%o0 + 0x08] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	stxa		%g0, [%o0 + 0x10] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	stxa		%g0, [%o0 + 0x18] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	stxa		%g0, [%o0 + 0x20] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	stxa		%g0, [%o0 + 0x28] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	stxa		%g0, [%o0 + 0x30] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	stxa		%g0, [%o0 + 0x38] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	stxa		%g0, [%o0 + 0x40] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	stxa		%g0, [%o0 + 0x48] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	stxa		%g0, [%o0 + 0x50] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	stxa		%g0, [%o0 + 0x58] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	stxa		%g0, [%o0 + 0x60] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	stxa		%g0, [%o0 + 0x68] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	stxa		%g0, [%o0 + 0x70] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	stxa		%g0, [%o0 + 0x78] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	stxa		%g0, [%o0 + 0x80] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	stxa		%g0, [%o0 + 0x88] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	stxa		%g0, [%o0 + 0x90] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	stxa		%g0, [%o0 + 0x98] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	stxa		%g0, [%o0 + 0xa0] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	stxa		%g0, [%o0 + 0xa8] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	stxa		%g0, [%o0 + 0xb0] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	stxa		%g0, [%o0 + 0xb8] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	stxa		%g0, [%o0 + 0xc0] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	stxa		%g0, [%o0 + 0xc8] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	stxa		%g0, [%o0 + 0xd0] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	stxa		%g0, [%o0 + 0xd8] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	stxa		%g0, [%o0 + 0xe0] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	stxa		%g0, [%o0 + 0xe8] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	stxa		%g0, [%o0 + 0xf0] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	stxa		%g0, [%o0 + 0xf8] %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	subcc		%g7, 256, %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	bne,pt		%xcc, 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 add		%o0, 256, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	wr		%g3, 0x0, %asi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	membar		#Sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define BRANCH_ALWAYS	0x10680000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define NOP		0x01000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define NG_DO_PATCH(OLD, NEW)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	sethi	%hi(NEW), %g1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	or	%g1, %lo(NEW), %g1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	sethi	%hi(OLD), %g2; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	or	%g2, %lo(OLD), %g2; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	sub	%g1, %g2, %g1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	sethi	%hi(BRANCH_ALWAYS), %g3; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	sll	%g1, 11, %g1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	srl	%g1, 11 + 2, %g1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	or	%g3, %lo(BRANCH_ALWAYS), %g3; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	or	%g3, %g1, %g3; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	stw	%g3, [%g2]; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	sethi	%hi(NOP), %g3; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	or	%g3, %lo(NOP), %g3; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	stw	%g3, [%g2 + 0x4]; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	flush	%g2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	.globl	niagara_patch_pageops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.type	niagara_patch_pageops,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) niagara_patch_pageops:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	NG_DO_PATCH(copy_user_page, NGcopy_user_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	NG_DO_PATCH(_clear_page, NGclear_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	NG_DO_PATCH(clear_user_page, NGclear_user_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.size	niagara_patch_pageops,.-niagara_patch_pageops