Thread (3 messages) 3 messages, 3 authors, 3d ago

Re: [PATCH] powerpc/64s: Clarify copy_and_flush() cache sync loop comment

From: Mukesh Kumar Chaurasiya <hidden>
Date: 2026-07-02 05:28:28
Also in: lkml

On Wed, Jul 01, 2026 at 11:57:56PM +0530, Nikhil Kumar Singh wrote:
quoted hunk ↗ jump to hunk
The value loaded into r0 in copy_and_flush() represents the number of
8-byte words processed between cache synchronization operations.

The existing comment refers to cache line size, which can make it appear
that the value is a cache line size in bytes rather than a loop count.
Clarify the comment to explain that the loop processes 8 words (64 bytes)
per cache synchronization iteration, and that increasing the value would
skip cache maintenance for intermediate cache lines.

This is a comment-only change with no functional impact.

Signed-off-by: Nikhil Kumar Singh <redacted>
---
 arch/powerpc/kernel/head_64.S | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 63432a33ec49..e21c2bce8f7e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -713,14 +713,14 @@ p_end: .8byte _end - copy_to_here
 _GLOBAL(copy_and_flush)
 	addi	r5,r5,-8
 	addi	r6,r6,-8
-4:	li	r0,8			/* Use the smallest common	*/
-					/* denominator cache line	*/
-					/* size.  This results in	*/
-					/* extra cache line flushes	*/
-					/* but operation is correct.	*/
-					/* Can't get cache line size	*/
-					/* from NACA as it is being	*/
-					/* moved too.			*/
+4:	li	r0,8			/* r0 is the number of 8-byte words       */
+					/* to copy per cache sync iteration.      */
+					/* 8 words * 8 bytes = 64 bytes. 64B is   */
+					/* the current default cache line size.   */
+					/* This is a loop count, not a byte       */
+					/* count. Increasing it will skip         */
+					/* dcbst/icbi for lines in between and    */
+					/* leave stale instructions in icache.    */
 
You dropped 2 pieces of information here, That we can't use NACA and
that we are doing an extra cache line flush(atleast in case of P10).

Also use tab instead of spaces before commment close per line "*/" can
you keep the last character aligned to rest of the file. It looks
little nicer.

Regards,
Mukesh
 	mtctr	r0			/* put # words/line in ctr	*/
 3:	addi	r6,r6,8			/* copy a cache line		*/
-- 
2.43.5
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help