Skip to contentSkip to conversation

LoongArch: Use VALEN instead of hard code in comments

PATCH Applied Enze Li 3 participants 4 messages Apr 12, 2023 LoongArch

lore
Share & tools
lore

Enze Li

author
#0 lore raw

PATCH 1/1 LoongArch: Use VALEN instead of hard code in comments

Refer to the online documentation[1] for Loongson, use the accurate VALEN in comments to avoid misleading others.

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#page-global-directory-base-address-for-lower-half-address-space

---
 arch/loongarch/include/asm/loongarch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/include/asm/loongarch.h +2 -2
index 65b7dcdea16d..a182a1579148 100644
@@ -423,9 +423,9 @@ static __always_inline void iocsr_write64(u64 val, u32 reg)
 #define  CSR_ASID_ASID_WIDTH		10
 #define  CSR_ASID_ASID			(_ULCAST_(0x3ff) << CSR_ASID_ASID_SHIFT)
 
-#define LOONGARCH_CSR_PGDL		0x19	/* Page table base address when VA[47] = 0 */
+#define LOONGARCH_CSR_PGDL		0x19	/* Page table base address when VA[VALEN-1] = 0 */
 
-#define LOONGARCH_CSR_PGDH		0x1a	/* Page table base address when VA[47] = 1 */
+#define LOONGARCH_CSR_PGDH		0x1a	/* Page table base address when VA[VALEN-1] = 1 */
 
 #define LOONGARCH_CSR_PGD		0x1b	/* Page table base */
 

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Enze Li

Refer to the online documentation[1] for Loongson, use the accurate VALEN in comments to avoid misleading others.

Reworded some Chinglish for you:

Subject: LoongArch: Replace hard-coded values in comments with VALEN

According to LoongArch documentation [1], CSR.PGDL and CSR.PGDH are concerned with the VA's MSB which is VALEN-1 instead of always being 47. Fix comments to avoid misleading others.

Quoted 2 lines

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#page-global-directory-base-address-for-lower-half-address-space

Nit: add a colon after [1]. (i.e. "[1]: xxxxx")

Quoted 23 lines
---
  arch/loongarch/include/asm/loongarch.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/include/asm/loongarch.h +2 -2
index 65b7dcdea16d..a182a1579148 100644
@@ -423,9 +423,9 @@ static __always_inline void iocsr_write64(u64 val, u32 reg)
  #define  CSR_ASID_ASID_WIDTH		10
  #define  CSR_ASID_ASID			(_ULCAST_(0x3ff) << CSR_ASID_ASID_SHIFT)
 
-#define LOONGARCH_CSR_PGDL		0x19	/* Page table base address when VA[47] = 0 */
+#define LOONGARCH_CSR_PGDL		0x19	/* Page table base address when VA[VALEN-1] = 0 */
 
-#define LOONGARCH_CSR_PGDH		0x1a	/* Page table base address when VA[47] = 1 */
+#define LOONGARCH_CSR_PGDH		0x1a	/* Page table base address when VA[VALEN-1] = 1 */
 
  #define LOONGARCH_CSR_PGD		0x1b	/* Page table base */
 
Quoted 1 line

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Change itself is trivial enough, thanks!

With the nits addressed: (Huacai may apply the suggestion while applying to loongarch-next, so you won't have to resend v2)

Signature · 3 lines
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
maintainer Applied
#2 lore raw

Queued, thanks.

Huacai

Quoted 55 lines · WANG Xuerui
Quoted 2 lines · Enze Li

Refer to the online documentation[1] for Loongson, use the accurate VALEN in comments to avoid misleading others.

Reworded some Chinglish for you:

Subject: LoongArch: Replace hard-coded values in comments with VALEN

According to LoongArch documentation [1], CSR.PGDL and CSR.PGDH are concerned with the VA's MSB which is VALEN-1 instead of always being 47. Fix comments to avoid misleading others.

Quoted 2 lines

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#page-global-directory-base-address-for-lower-half-address-space

Nit: add a colon after [1]. (i.e. "[1]: xxxxx")

Quoted 23 lines
---
  arch/loongarch/include/asm/loongarch.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/include/asm/loongarch.h +2 -2
index 65b7dcdea16d..a182a1579148 100644
@@ -423,9 +423,9 @@ static __always_inline void iocsr_write64(u64 val, u32 reg)
  #define  CSR_ASID_ASID_WIDTH                10
  #define  CSR_ASID_ASID                      (_ULCAST_(0x3ff) << CSR_ASID_ASID_SHIFT)
 
-#define LOONGARCH_CSR_PGDL           0x19    /* Page table base address when VA[47] = 0 */
+#define LOONGARCH_CSR_PGDL           0x19    /* Page table base address when VA[VALEN-1] = 0 */
 
-#define LOONGARCH_CSR_PGDH           0x1a    /* Page table base address when VA[47] = 1 */
+#define LOONGARCH_CSR_PGDH           0x1a    /* Page table base address when VA[VALEN-1] = 1 */
 
  #define LOONGARCH_CSR_PGD           0x1b    /* Page table base */
 
Quoted 1 line

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Change itself is trivial enough, thanks!

With the nits addressed: (Huacai may apply the suggestion while applying to loongarch-next, so you won't have to resend v2)

--
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/

author
#3 lore raw
In reply to WANG Xuerui

Hi Xuerui,

Thanks for your review.

Quoted 5 lines · WANG Xuerui
Quoted 2 lines · Enze Li

Refer to the online documentation[1] for Loongson, use the accurate VALEN in comments to avoid misleading others.

Reworded some Chinglish for you:

My English sucks :( Please bear with me.

Quoted 39 lines

Subject: LoongArch: Replace hard-coded values in comments with VALEN

According to LoongArch documentation [1], CSR.PGDL and CSR.PGDH are concerned with the VA's MSB which is VALEN-1 instead of always being 47.
Fix comments to avoid misleading others.

Quoted 2 lines

[1]
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#page-global-directory-base-address-for-lower-half-address-space

Nit: add a colon after [1]. (i.e. "[1]: xxxxx")

Quoted 26 lines
---
  arch/loongarch/include/asm/loongarch.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/include/asm/loongarch.h +0 -1
index 65b7dcdea16d..a182a1579148 100644
@@ -423,9 +423,9 @@ static __always_inline void iocsr_write64(u64
 val, u32 reg)
  #define  CSR_ASID_ASID_WIDTH		10
  #define  CSR_ASID_ASID			(_ULCAST_(0x3ff) <<
 CSR_ASID_ASID_SHIFT)
 
-#define LOONGARCH_CSR_PGDL		0x19	/* Page table base

address when VA[47] = 0 */
+#define LOONGARCH_CSR_PGDL 0x19 /* Page table base
address when VA[VALEN-1] = 0 */

-#define LOONGARCH_CSR_PGDH 0x1a /* Page table base
address when VA[47] = 1 */
+#define LOONGARCH_CSR_PGDH 0x1a /* Page table base
address when VA[VALEN-1] = 1 */

Quoted 7 lines
Quoted 5 lines

#define LOONGARCH_CSR_PGD 0x1b /* Page table base
*/

base-commit: fc89d7fb499b0162e081f434d45e8d1b47e82ece

Change itself is trivial enough, thanks!

I was very impressed with your patience and willingness to help.

Best Regards,
Enze

Quoted 7 lines

With the nits addressed: (Huacai may apply the suggestion while applying
to loongarch-next, so you won't have to resend v2)