You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/28 09:54:39 UTC

[GitHub] [incubator-nuttx] zhuyanlinzyl opened a new pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

zhuyanlinzyl opened a new pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367


   Must save a4 register in assembler.
   
   Signed-off-by: zhuyanlin <zh...@xiaomi.com>
   
   ## Summary
   
   fix bug in a4 save in xxx_dcache_all.S
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r794364612



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -91,12 +91,16 @@
 
 cp15_flush_dcache_all:
 
+	push		{r4}
+
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r4, r0
+
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
 	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	add		r4, r3, r4, lsr #3		/* r4=(number of ways - 1) */

Review comment:
       let's reuse r3 to avoid push/pop r4?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1026651475


   We are in Spring Festival and come back to work in the next week.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl commented on a change in pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r801420728



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,32 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
 
-	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
-	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
+	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	and		r1, r3, r1, lsr #3		/* r1=(number of ways - 1) */
 
-	mov		r1, #0				/* r1 = way loop counter */
 way_loop:
-
-	mov		r3, #0				/* r3 = set loop counter */
+	mov		r3, r0				/* Init Sets */
 set_loop:
 	mov		r2, r1, lsl #30			/* r2 = way loop counter << 30 */
 	orr		r2, r3, lsl #5			/* r2 = set/way cache operation format */
-	mcr		CP15_DCCISW(r2)			/* Data Cache Invalidate by Set/Way */
-	add		r3, r3, #1			/* Increment set counter */
-	cmp		r0, r3				/* Last set? */
-	bne		set_loop			/* Keep looping if not */
+	mcr		CP15_DCCSW(r2)			/* Data Cache Clean by Set/Way */
+	subs		r3, r3, #1			/* Subtraction set counter */
+	bcs		set_loop			/* Keep looping if not */
 
-	add		r1, r1, #1			/* Increment the way counter */
-	cmp		r4, r1				/* Last way */
-	bne		way_loop			/* Keep looping if not */
+	sub		r1, r1, #1			/* Subtraction the way counter */

Review comment:
       It's a typ mistake. I fix and update the patch @masayuki2009 .




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800369205



##########
File path: arch/arm/src/armv7-r/cp15_flush_dcache_all.S
##########
@@ -86,36 +86,36 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_clean_dcache_all
-	.type	cp15_clean_dcache_all, function
+	.globl	cp15_flush_dcache_all
+	.type	cp15_flush_dcache_all, function
 
-cp15_clean_dcache_all:
+cp15_flush_dcache_all:
 
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r1, r0

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1031344970


   >@masayuki2009 @pkarashchenko I update a new patch, please review again.
   >
   >Use sub loop instead of add loop
   >And it work well in sabrelite qemu.
   
   @zhuyanlinzyl 
   
   Did you test with your board (I think Xiaomi uses dual Cortex-A7-based board) as well? 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1031045290


   @masayuki2009 @pkarashchenko  I update a new patch, please review again.
   
   Use sub loop instead off add loop


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl edited a comment on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl edited a comment on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1031045290


   @masayuki2009 @pkarashchenko  I update a new patch, please review again.
   
   Use sub loop instead of add loop
   
   
   And it work well  in sabrelite qemu.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800369397



##########
File path: arch/arm/src/armv7-r/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,36 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
 
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r1, r0

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r801257461



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,34 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
 
-	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
-	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
+	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	and		r1, r3, r1, lsr #3		/* r1=(number of ways - 1) */
 
-	mov		r1, #0				/* r1 = way loop counter */
 way_loop:
-
-	mov		r3, #0				/* r3 = set loop counter */
+	mov		r3, r0				/* Init Sets */
 set_loop:
 	mov		r2, r1, lsl #30			/* r2 = way loop counter << 30 */
 	orr		r2, r3, lsl #5			/* r2 = set/way cache operation format */
-	mcr		CP15_DCCISW(r2)			/* Data Cache Invalidate by Set/Way */
-	add		r3, r3, #1			/* Increment set counter */
-	cmp		r0, r3				/* Last set? */
+	mcr		CP15_DCCSW(r2)			/* Data Cache Clean by Set/Way */
+	sub		r3, r3, #1			/* Subtraction set counter */
+	cmp		r3, #0				/* Last set? */
 	bne		set_loop			/* Keep looping if not */
 
-	add		r1, r1, #1			/* Increment the way counter */
-	cmp		r4, r1				/* Last way */
+	sub		r1, r1, #1			/* Subtraction the way counter */
+	cmp		r1, #0				/* Last way? */

Review comment:
       @zhuyanlinzyl 
   Is this condition correct?
   If the number of ways equals 4 (i.e. r1 = 3), it hits only 3times.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1026644925


   @zhuyanlinzyl do you have possibility to address comments this week?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl commented on a change in pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r801318847



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,34 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
 
-	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
-	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
+	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	and		r1, r3, r1, lsr #3		/* r1=(number of ways - 1) */
 
-	mov		r1, #0				/* r1 = way loop counter */
 way_loop:
-
-	mov		r3, #0				/* r3 = set loop counter */
+	mov		r3, r0				/* Init Sets */
 set_loop:
 	mov		r2, r1, lsl #30			/* r2 = way loop counter << 30 */
 	orr		r2, r3, lsl #5			/* r2 = set/way cache operation format */
-	mcr		CP15_DCCISW(r2)			/* Data Cache Invalidate by Set/Way */
-	add		r3, r3, #1			/* Increment set counter */
-	cmp		r0, r3				/* Last set? */
+	mcr		CP15_DCCSW(r2)			/* Data Cache Clean by Set/Way */
+	sub		r3, r3, #1			/* Subtraction set counter */
+	cmp		r3, #0				/* Last set? */
 	bne		set_loop			/* Keep looping if not */
 
-	add		r1, r1, #1			/* Increment the way counter */
-	cmp		r4, r1				/* Last way */
+	sub		r1, r1, #1			/* Subtraction the way counter */
+	cmp		r1, #0				/* Last way? */

Review comment:
       @masayuki2009  
   
   Yes, `sub` and `bne` only loop 3times.
   I use `subs` and `bcs` , It should loop 4times.
   
   I update the patch. please review agian.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800428595



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -91,12 +91,16 @@
 
 cp15_flush_dcache_all:
 
+	push		{r4}
+
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r4, r0
+
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
 	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	add		r4, r3, r4, lsr #3		/* r4=(number of ways - 1) */

Review comment:
       I see that comment about `and` vs `add` is not answered. I would appreciate if author can write here the answer




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r794964791



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -91,12 +91,16 @@
 
 cp15_flush_dcache_all:
 
+	push		{r4}
+
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r4, r0
+
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
 	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	add		r4, r3, r4, lsr #3		/* r4=(number of ways - 1) */

Review comment:
       @zhuyanlinzyl @xiaoxiang781216 
   I agree to remove r4 and reuse some register (perhaps r1?).
   By the way, I think ```add r4, r3, r0, lsr #3``` means ```r4 = r3 + (r0 >> 3)```.
   I thought it would be ```and r4, r3, r0, lsr #3  (i.e. r4 = r3 & (r0 >> 3)```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 merged pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

Posted by GitBox <gi...@apache.org>.
masayuki2009 merged pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800369044



##########
File path: arch/arm/src/armv7-r/cp15_invalidate_dcache_all.S
##########
@@ -92,26 +92,26 @@
 cp15_invalidate_dcache_all:
 
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r1, r0
+
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
 	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
 

Review comment:
       change to:
   ```
   	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
   
   	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
   	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800377974



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -91,12 +91,16 @@
 
 cp15_flush_dcache_all:
 
+	push		{r4}
+
 	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
+	mov		r4, r0
+
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
 	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	add		r4, r3, r4, lsr #3		/* r4=(number of ways - 1) */

Review comment:
       @masayuki2009 could you try the update?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r801412677



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,32 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
 
-	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
-	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
+	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	and		r1, r3, r1, lsr #3		/* r1=(number of ways - 1) */
 
-	mov		r1, #0				/* r1 = way loop counter */
 way_loop:
-
-	mov		r3, #0				/* r3 = set loop counter */
+	mov		r3, r0				/* Init Sets */
 set_loop:
 	mov		r2, r1, lsl #30			/* r2 = way loop counter << 30 */
 	orr		r2, r3, lsl #5			/* r2 = set/way cache operation format */
-	mcr		CP15_DCCISW(r2)			/* Data Cache Invalidate by Set/Way */
-	add		r3, r3, #1			/* Increment set counter */
-	cmp		r0, r3				/* Last set? */
-	bne		set_loop			/* Keep looping if not */
+	mcr		CP15_DCCSW(r2)			/* Data Cache Clean by Set/Way */
+	subs		r3, r3, #1			/* Subtraction set counter */
+	bcs		set_loop			/* Keep looping if not */
 
-	add		r1, r1, #1			/* Increment the way counter */
-	cmp		r4, r1				/* Last way */
-	bne		way_loop			/* Keep looping if not */
+	sub		r1, r1, #1			/* Subtraction the way counter */

Review comment:
       @zhuyanlinzyl 
   ```subs```?
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl edited a comment on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl edited a comment on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1031045290


   @masayuki2009 @pkarashchenko  I update a new patch, please review again.
   
   Use sub loop instead off add loop
   
   
   And it work well  in sabrelite qemu.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1032191580


   @masayuki2009  Yes, I test in our smp a7 board, this patch can work


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #5367: armv7-r/a: bugfix: fix a4 register use but not store in xxx_invalidate/flush/clean_all.S

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#discussion_r801412677



##########
File path: arch/arm/src/armv7-a/cp15_clean_dcache_all.S
##########
@@ -86,36 +86,32 @@
  *
  ****************************************************************************/
 
-	.globl	cp15_flush_dcache_all
-	.type	cp15_flush_dcache_all, function
+	.globl	cp15_clean_dcache_all
+	.type	cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+	mrc		CP15_CCSIDR(r1)			/* Read the Cache Size Identification Register */
 
-	mrc		CP15_CCSIDR(r0)			/* Read the Cache Size Identification Register */
 	ldr		r3, =0x7fff			/* Isolate the NumSets field (bits 13-27) */
-	and		r0, r3, r0, lsr #13		/* r0=NumSets (number of sets - 1) */
+	and		r0, r3, r1, lsr #13		/* r0=NumSets (number of sets - 1) */
 
 	ldr		r3, =0x3ff			/* Isolate the way field (bits 3-12) */
-	add		r4, r3, r0, lsr #3		/* r4=(number of ways - 1) */
+	and		r1, r3, r1, lsr #3		/* r1=(number of ways - 1) */
 
-	mov		r1, #0				/* r1 = way loop counter */
 way_loop:
-
-	mov		r3, #0				/* r3 = set loop counter */
+	mov		r3, r0				/* Init Sets */
 set_loop:
 	mov		r2, r1, lsl #30			/* r2 = way loop counter << 30 */
 	orr		r2, r3, lsl #5			/* r2 = set/way cache operation format */
-	mcr		CP15_DCCISW(r2)			/* Data Cache Invalidate by Set/Way */
-	add		r3, r3, #1			/* Increment set counter */
-	cmp		r0, r3				/* Last set? */
-	bne		set_loop			/* Keep looping if not */
+	mcr		CP15_DCCSW(r2)			/* Data Cache Clean by Set/Way */
+	subs		r3, r3, #1			/* Subtraction set counter */
+	bcs		set_loop			/* Keep looping if not */
 
-	add		r1, r1, #1			/* Increment the way counter */
-	cmp		r4, r1				/* Last way */
-	bne		way_loop			/* Keep looping if not */
+	sub		r1, r1, #1			/* Subtraction the way counter */

Review comment:
       @zhuyanlinzyl 
   subs?
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #5367: armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #5367:
URL: https://github.com/apache/incubator-nuttx/pull/5367#issuecomment-1031230057


   hi, pkarashchenko ,
   
   
   `And`  is right,  as it is `&=`
   
   
   `Add`  is wrong, I fix it in new patch.
   
   
   You can review in this PR
   
   
   https://github.com/apache/incubator-nuttx/pull/5367
   
   
   ________________________________
   From: Petro Karashchenko ***@***.***>
   Sent: 07 February 2022 16:50
   To: apache/incubator-nuttx
   Cc: 朱琰琳; Mention
   Subject: [External Mail]Re: [apache/incubator-nuttx] armv7-r/a: bugfix: save and restore a4 register in xxx_dcache_all.S (PR #5367)
   
   
   *This message originated from outside of XIAOMI. Please treat this email with caution*
   
   
   @pkarashchenko commented on this pull request.
   
   ________________________________
   
   In arch/arm/src/armv7-a/cp15_clean_dcache_all.S<https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800428595>:
   
   >       ldr             r3, =0x7fff                     /* Isolate the NumSets field (bits 13-27) */
           and             r0, r3, r0, lsr #13             /* r0=NumSets (number of sets - 1) */
   
           ldr             r3, =0x3ff                      /* Isolate the way field (bits 3-12) */
   -       add             r4, r3, r0, lsr #3              /* r4=(number of ways - 1) */
   +       add             r4, r3, r4, lsr #3              /* r4=(number of ways - 1) */
   
   
   I see that comment about and vs add is not answered. I would appreciate if author can write here the answer
   
   ―
   Reply to this email directly, view it on GitHub<https://github.com/apache/incubator-nuttx/pull/5367#discussion_r800428595>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AU6JSNI4BU6KATB5KL5K6CLUZ6BTZANCNFSM5NAJOP4A>.
   Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
   You are receiving this because you were mentioned.Message ID: ***@***.***>
   
   #/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org