leon: add SDK patches from buildroot-2022.02-1.2/5.10.175
[openwrt/staging/wigyori.git] / target / linux / leon / patches-5.15 / 0004-sparc-optimize-MMU-fault-trap-entry.patch
diff --git a/target/linux/leon/patches-5.15/0004-sparc-optimize-MMU-fault-trap-entry.patch b/target/linux/leon/patches-5.15/0004-sparc-optimize-MMU-fault-trap-entry.patch
new file mode 100644 (file)
index 0000000..f442890
--- /dev/null
@@ -0,0 +1,66 @@
+From 71be356f33277110d573628121f0c6b27335e184 Mon Sep 17 00:00:00 2001
+From: Daniel Hellstrom <daniel@gaisler.com>
+Date: Wed, 18 Feb 2015 11:48:42 +0100
+Subject: [PATCH 04/32] sparc: optimize MMU fault trap entry
+
+Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
+---
+ arch/sparc/kernel/entry.S | 24 ++++++++++--------------
+ arch/sparc/mm/fault_32.c  |  3 ---
+ 2 files changed, 10 insertions(+), 17 deletions(-)
+
+diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
+index d58940280f8d..d176493ea0b5 100644
+--- a/arch/sparc/kernel/entry.S
++++ b/arch/sparc/kernel/entry.S
+@@ -775,23 +775,19 @@ SUN_PI_(lda      [%l5] ASI_M_MMUREGS, %l6)       ! read sfar first
+ LEON_PI(lda   [%l4] ASI_LEON_MMUREGS, %l5)    ! read sfsr last
+ SUN_PI_(lda   [%l4] ASI_M_MMUREGS, %l5)       ! read sfsr last
+-      andn    %l6, 0xfff, %l6
+-      srl     %l5, 6, %l5                     ! and encode all info into l7
+-
+-      and     %l5, 2, %l5
+-      or      %l5, %l6, %l6
+-
+-      or      %l6, %l7, %l7                   ! l7 = [addr,write,txtfault]
++      and     %l5, 0x0e0, %l5         ! save AT
++      andn    %l6, 0xfff, %l6         ! save faulting page
++      or      %l5, %l6, %l6           ! and encode all info into l7
++      or      %l6, %l7, %l7           ! l7 = [addr,AT,txtfault]
+       SAVE_ALL
+-      mov     %l7, %o1
+-      mov     %l7, %o2
+-      and     %o1, 1, %o1             ! arg2 = text_faultp
+-      mov     %l7, %o3
+-      and     %o2, 2, %o2             ! arg3 = writep
+-      andn    %o3, 0xfff, %o3         ! arg4 = faulting address
+-
++      andcc   %l7, 1, %o1             ! arg2 = text_faultp
++      and     %l7, 0x80, %o2          ! arg3 = writep from AT
++      bne     1f
++       mov    %l1, %o3                ! arg4 = faulting TEXT address (PC)
++      andn    %l7, 0xfff, %o3         ! arg4 = faulting DATA address
++1:
+       wr      %l0, PSR_ET, %psr
+       WRITE_PAUSE
+diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
+index 40ce087dfecf..e2c3257dfdab 100644
+--- a/arch/sparc/mm/fault_32.c
++++ b/arch/sparc/mm/fault_32.c
+@@ -169,9 +169,6 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
+       vm_fault_t fault;
+       unsigned int flags = FAULT_FLAG_DEFAULT;
+-      if (text_fault)
+-              address = regs->pc;
+-
+       /*
+        * We fault-in kernel-space virtual memory on-demand. The
+        * 'reference' page table is init_mm.pgd.
+-- 
+2.34.1
+