Re: [PATCH] arch/sparc: Avoid DCTI Couples

2017-03-10 Thread David Miller
From: Babu Moger 
Date: Fri, 10 Mar 2017 15:47:03 -0700

> Avoid un-intended DCTI Couples. Use of DCTI couples is deprecated.
> Refer UltraSPARC Architecture 2005(Section 6.3.4.7 - DCTI Couples).
> http://www.oracle.com/technetwork/systems/opensparc/1537734

An annulled branch-always has no delay slot.

These code sequences are intentional to keep code size down.

I'm not applying this.


Re: [PATCH] arch/sparc: Avoid DCTI Couples

2017-03-10 Thread David Miller
From: Babu Moger 
Date: Fri, 10 Mar 2017 15:47:03 -0700

> Avoid un-intended DCTI Couples. Use of DCTI couples is deprecated.
> Refer UltraSPARC Architecture 2005(Section 6.3.4.7 - DCTI Couples).
> http://www.oracle.com/technetwork/systems/opensparc/1537734

An annulled branch-always has no delay slot.

These code sequences are intentional to keep code size down.

I'm not applying this.


[PATCH] arch/sparc: Avoid DCTI Couples

2017-03-10 Thread Babu Moger
Avoid un-intended DCTI Couples. Use of DCTI couples is deprecated.
Refer UltraSPARC Architecture 2005(Section 6.3.4.7 - DCTI Couples).
http://www.oracle.com/technetwork/systems/opensparc/1537734

"A delayed control transfer instruction (DCTI) in the delay slot of another
DCTI is referred to as a DCTI couple. The use of DCTI couples is deprecated
in the Oracle SPARC Architecture; no new software should place a DCTI in
the delay slot of another DCTI, because on future Oracle SPARC Architecture
implementations DCTI couples may execute either slowly or differently than
the programmer assumes it will."

Signed-off-by: Babu Moger 
Reviewed-by: Rob Gardner 
---
 arch/sparc/kernel/head_64.S|4 
 arch/sparc/kernel/misctrap.S   |1 +
 arch/sparc/kernel/rtrap_64.S   |1 +
 arch/sparc/kernel/spiterrs.S   |1 +
 arch/sparc/kernel/sun4v_tlb_miss.S |1 +
 arch/sparc/kernel/urtt_fill.S  |1 +
 arch/sparc/kernel/winfixup.S   |2 ++
 arch/sparc/lib/NG2memcpy.S |4 
 arch/sparc/lib/NG4memcpy.S |1 +
 arch/sparc/lib/NG4memset.S |1 +
 arch/sparc/lib/NGmemcpy.S  |1 +
 11 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 6aa3da1..4410119 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -96,6 +96,7 @@ sparc64_boot:
andn%g1, PSTATE_AM, %g1
wrpr%g1, 0x0, %pstate
ba,a,pt %xcc, 1f
+nop
 
.globl  prom_finddev_name, prom_chosen_path, prom_root_node
.globl  prom_getprop_name, prom_mmu_name, prom_peer_name
@@ -613,6 +614,7 @@ niagara_tlb_fixup:
 nop
 
ba,a,pt %xcc, 80f
+nop
 niagara4_patch:
callniagara4_patch_copyops
 nop
@@ -622,6 +624,7 @@ niagara4_patch:
 nop
 
ba,a,pt %xcc, 80f
+nop
 
 niagara2_patch:
callniagara2_patch_copyops
@@ -632,6 +635,7 @@ niagara2_patch:
 nop
 
ba,a,pt %xcc, 80f
+nop
 
 niagara_patch:
callniagara_patch_copyops
diff --git a/arch/sparc/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S
index 34b4933..9276d2f 100644
--- a/arch/sparc/kernel/misctrap.S
+++ b/arch/sparc/kernel/misctrap.S
@@ -82,6 +82,7 @@ do_stdfmna:
callhandle_stdfmna
 add%sp, PTREGS_OFF, %o0
ba,a,pt %xcc, rtrap
+nop
.size   do_stdfmna,.-do_stdfmna
 
.type   breakpoint_trap,#function
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 216948c..709a82e 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -237,6 +237,7 @@ rt_continue:ldx [%sp + 
PTREGS_OFF + PT_V9_G1], %g1
bne,pt  %xcc, user_rtt_fill_32bit
 wrpr   %g1, %cwp
ba,a,pt %xcc, user_rtt_fill_64bit
+nop
 
 user_rtt_fill_fixup_dax:
ba,pt   %xcc, user_rtt_fill_fixup_common
diff --git a/arch/sparc/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S
index 4a73009..d7e5408 100644
--- a/arch/sparc/kernel/spiterrs.S
+++ b/arch/sparc/kernel/spiterrs.S
@@ -86,6 +86,7 @@ __spitfire_cee_trap_continue:
 rd %pc, %g7
 
ba,a,pt %xcc, 2f
+nop
 
 1: ba,pt   %xcc, etrap_irq
 rd %pc, %g7
diff --git a/arch/sparc/kernel/sun4v_tlb_miss.S 
b/arch/sparc/kernel/sun4v_tlb_miss.S
index 6179e19..c19f352 100644
--- a/arch/sparc/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc/kernel/sun4v_tlb_miss.S
@@ -352,6 +352,7 @@ sun4v_mna:
callsun4v_do_mna
 add%sp, PTREGS_OFF, %o0
ba,a,pt %xcc, rtrap
+nop
 
/* Privileged Action.  */
 sun4v_privact:
diff --git a/arch/sparc/kernel/urtt_fill.S b/arch/sparc/kernel/urtt_fill.S
index 5604a2b..364af32 100644
--- a/arch/sparc/kernel/urtt_fill.S
+++ b/arch/sparc/kernel/urtt_fill.S
@@ -92,6 +92,7 @@ user_rtt_fill_fixup_common:
callsun4v_data_access_exception
 nop
ba,a,pt %xcc, rtrap
+nop
 
 1: callspitfire_data_access_exception
 nop
diff --git a/arch/sparc/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index 855019a..1ee173c 100644
--- a/arch/sparc/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
@@ -152,6 +152,8 @@ fill_fixup_dax:
callsun4v_data_access_exception
 nop
ba,a,pt %xcc, rtrap
+nop
 1: callspitfire_data_access_exception
 nop
ba,a,pt %xcc, rtrap
+nop
diff --git a/arch/sparc/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S
index c629dbd..64dcd6c 100644
--- a/arch/sparc/lib/NG2memcpy.S
+++ b/arch/sparc/lib/NG2memcpy.S
@@ -326,11 +326,13 @@ FUNC_NAME:/* %o0=dst, %o1=src, 

[PATCH] arch/sparc: Avoid DCTI Couples

2017-03-10 Thread Babu Moger
Avoid un-intended DCTI Couples. Use of DCTI couples is deprecated.
Refer UltraSPARC Architecture 2005(Section 6.3.4.7 - DCTI Couples).
http://www.oracle.com/technetwork/systems/opensparc/1537734

"A delayed control transfer instruction (DCTI) in the delay slot of another
DCTI is referred to as a DCTI couple. The use of DCTI couples is deprecated
in the Oracle SPARC Architecture; no new software should place a DCTI in
the delay slot of another DCTI, because on future Oracle SPARC Architecture
implementations DCTI couples may execute either slowly or differently than
the programmer assumes it will."

Signed-off-by: Babu Moger 
Reviewed-by: Rob Gardner 
---
 arch/sparc/kernel/head_64.S|4 
 arch/sparc/kernel/misctrap.S   |1 +
 arch/sparc/kernel/rtrap_64.S   |1 +
 arch/sparc/kernel/spiterrs.S   |1 +
 arch/sparc/kernel/sun4v_tlb_miss.S |1 +
 arch/sparc/kernel/urtt_fill.S  |1 +
 arch/sparc/kernel/winfixup.S   |2 ++
 arch/sparc/lib/NG2memcpy.S |4 
 arch/sparc/lib/NG4memcpy.S |1 +
 arch/sparc/lib/NG4memset.S |1 +
 arch/sparc/lib/NGmemcpy.S  |1 +
 11 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 6aa3da1..4410119 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -96,6 +96,7 @@ sparc64_boot:
andn%g1, PSTATE_AM, %g1
wrpr%g1, 0x0, %pstate
ba,a,pt %xcc, 1f
+nop
 
.globl  prom_finddev_name, prom_chosen_path, prom_root_node
.globl  prom_getprop_name, prom_mmu_name, prom_peer_name
@@ -613,6 +614,7 @@ niagara_tlb_fixup:
 nop
 
ba,a,pt %xcc, 80f
+nop
 niagara4_patch:
callniagara4_patch_copyops
 nop
@@ -622,6 +624,7 @@ niagara4_patch:
 nop
 
ba,a,pt %xcc, 80f
+nop
 
 niagara2_patch:
callniagara2_patch_copyops
@@ -632,6 +635,7 @@ niagara2_patch:
 nop
 
ba,a,pt %xcc, 80f
+nop
 
 niagara_patch:
callniagara_patch_copyops
diff --git a/arch/sparc/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S
index 34b4933..9276d2f 100644
--- a/arch/sparc/kernel/misctrap.S
+++ b/arch/sparc/kernel/misctrap.S
@@ -82,6 +82,7 @@ do_stdfmna:
callhandle_stdfmna
 add%sp, PTREGS_OFF, %o0
ba,a,pt %xcc, rtrap
+nop
.size   do_stdfmna,.-do_stdfmna
 
.type   breakpoint_trap,#function
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 216948c..709a82e 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -237,6 +237,7 @@ rt_continue:ldx [%sp + 
PTREGS_OFF + PT_V9_G1], %g1
bne,pt  %xcc, user_rtt_fill_32bit
 wrpr   %g1, %cwp
ba,a,pt %xcc, user_rtt_fill_64bit
+nop
 
 user_rtt_fill_fixup_dax:
ba,pt   %xcc, user_rtt_fill_fixup_common
diff --git a/arch/sparc/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S
index 4a73009..d7e5408 100644
--- a/arch/sparc/kernel/spiterrs.S
+++ b/arch/sparc/kernel/spiterrs.S
@@ -86,6 +86,7 @@ __spitfire_cee_trap_continue:
 rd %pc, %g7
 
ba,a,pt %xcc, 2f
+nop
 
 1: ba,pt   %xcc, etrap_irq
 rd %pc, %g7
diff --git a/arch/sparc/kernel/sun4v_tlb_miss.S 
b/arch/sparc/kernel/sun4v_tlb_miss.S
index 6179e19..c19f352 100644
--- a/arch/sparc/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc/kernel/sun4v_tlb_miss.S
@@ -352,6 +352,7 @@ sun4v_mna:
callsun4v_do_mna
 add%sp, PTREGS_OFF, %o0
ba,a,pt %xcc, rtrap
+nop
 
/* Privileged Action.  */
 sun4v_privact:
diff --git a/arch/sparc/kernel/urtt_fill.S b/arch/sparc/kernel/urtt_fill.S
index 5604a2b..364af32 100644
--- a/arch/sparc/kernel/urtt_fill.S
+++ b/arch/sparc/kernel/urtt_fill.S
@@ -92,6 +92,7 @@ user_rtt_fill_fixup_common:
callsun4v_data_access_exception
 nop
ba,a,pt %xcc, rtrap
+nop
 
 1: callspitfire_data_access_exception
 nop
diff --git a/arch/sparc/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index 855019a..1ee173c 100644
--- a/arch/sparc/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
@@ -152,6 +152,8 @@ fill_fixup_dax:
callsun4v_data_access_exception
 nop
ba,a,pt %xcc, rtrap
+nop
 1: callspitfire_data_access_exception
 nop
ba,a,pt %xcc, rtrap
+nop
diff --git a/arch/sparc/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S
index c629dbd..64dcd6c 100644
--- a/arch/sparc/lib/NG2memcpy.S
+++ b/arch/sparc/lib/NG2memcpy.S
@@ -326,11 +326,13 @@ FUNC_NAME:/* %o0=dst, %o1=src, %o2=len */
blu 170f
 nop