Skip to contentSkip to conversation

s390/pgtable: misc small improvements

PATCH Superseded Claudio Imbrenda 2 participants 5 messages Apr 26, 2024 – Apr 29, 2024

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover s390/pgtable: misc small improvements

This series has two small improvements for the s390 page tables. they fix some small inconsistencies and missing things.

The first aligns the layout of large puds with that of large pmds; there is no reason for the large pud read and write softbits to be swapped compared to large pmds.

The second adds a few bits to _SEGMENT_ENTRY_BITS, _SEGMENT_ENTRY_HARDWARE_BITS and _SEGMENT_ENTRY_HARDWARE_BITS_LARGE; those bits are supposed to always be zero, the current code was working correctly since those bits were being ignored and always left set to zero. The patch also introduces _REGION3_ENTRY_HARDWARE_BITS and _REGION3_ENTRY_HARDWARE_BITS_LARGE, for completeness, which are the bitmasks of the hardware bits for normal puds and large puds.

v3->v2
* update patch description for the second patch v2->v1
* add the missing pmd bits and _REGION3_ENTRY_HARDWARE_BITS

Claudio Imbrenda (2):
s390/pgtable: switch read and write softbits for puds s390/pgtable: add missing hardware bits for puds, pmds

 arch/s390/include/asm/pgtable.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.44.0
#1 lore raw

PATCH v3 1/2 s390/pgtable: switch read and write softbits for puds

There is no reason for the read and write softbits to be swapped in the puds compared to pmds. They are different only because the softbits for puds were introduced at the same time when the softbits for pmds were swapped.

The current implementation is not wrong per se, since the macros are defined correctly; only the documentation does not reflect reality.

With this patch, the read and write softbits for large pmd and large puds will have the same layout, and will match the existing documentation.

---
 arch/s390/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/pgtable.h +2 -2
index 60950e7a25f5..3da2995fd196 100644
@@ -266,8 +266,8 @@ static inline int is_module_addr(void *addr)
 #define _REGION3_ENTRY_DIRTY	0x2000	/* SW region dirty bit */
 #define _REGION3_ENTRY_YOUNG	0x1000	/* SW region young bit */
 #define _REGION3_ENTRY_LARGE	0x0400	/* RTTE-format control, large page  */
-#define _REGION3_ENTRY_READ	0x0002	/* SW region read bit */
-#define _REGION3_ENTRY_WRITE	0x0001	/* SW region write bit */
+#define _REGION3_ENTRY_WRITE	0x0002	/* SW region write bit */
+#define _REGION3_ENTRY_READ	0x0001	/* SW region read bit */
 
 #ifdef CONFIG_MEM_SOFT_DIRTY
 #define _REGION3_ENTRY_SOFT_DIRTY 0x4000 /* SW region soft dirty bit */
Signature · 1 line
2.44.0
#2 lore raw

PATCH v3 2/2 s390/pgtable: add missing hardware bits for puds, pmds

In reply to Claudio Imbrenda

Add the table type and ACCF validity bits to _SEGMENT_ENTRY_BITS and _SEGMENT_ENTRY_HARDWARE_BITS{,_LARGE}.

For completeness, introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE and _REGION3_ENTRY_HARDWARE_BITS, containing the hardware bits used for large puds and normal puds.

---
 arch/s390/include/asm/pgtable.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
arch/s390/include/asm/pgtable.h +5 -3
index 3da2995fd196..e2f713fae9c9 100644
@@ -262,6 +262,8 @@ static inline int is_module_addr(void *addr)
 #define _REGION3_ENTRY		(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
 #define _REGION3_ENTRY_EMPTY	(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID)
 
+#define _REGION3_ENTRY_HARDWARE_BITS_LARGE	0xffffffff8001073cUL
+#define _REGION3_ENTRY_HARDWARE_BITS		0xfffffffffffff6ffUL
 #define _REGION3_ENTRY_ORIGIN_LARGE ~0x7fffffffUL /* large page address	     */
 #define _REGION3_ENTRY_DIRTY	0x2000	/* SW region dirty bit */
 #define _REGION3_ENTRY_YOUNG	0x1000	/* SW region young bit */
@@ -278,9 +280,9 @@ static inline int is_module_addr(void *addr)
 #define _REGION_ENTRY_BITS	 0xfffffffffffff22fUL
 
 /* Bits in the segment table entry */
-#define _SEGMENT_ENTRY_BITS			0xfffffffffffffe33UL
-#define _SEGMENT_ENTRY_HARDWARE_BITS		0xfffffffffffffe30UL
-#define _SEGMENT_ENTRY_HARDWARE_BITS_LARGE	0xfffffffffff00730UL
+#define _SEGMENT_ENTRY_BITS			0xfffffffffffffe3fUL
+#define _SEGMENT_ENTRY_HARDWARE_BITS		0xfffffffffffffe3cUL
+#define _SEGMENT_ENTRY_HARDWARE_BITS_LARGE	0xfffffffffff1073cUL
 #define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address	    */
 #define _SEGMENT_ENTRY_ORIGIN	~0x7ffUL/* page table origin		    */
 #define _SEGMENT_ENTRY_PROTECT	0x200	/* segment protection bit	    */
Signature · 1 line
2.44.0
maintainer Reviewed-by on v3 2/2
#3 lore raw

Re: [PATCH v3 2/2] s390/pgtable: add missing hardware bits for puds, pmds

Quoted 11 lines · Claudio Imbrenda

Add the table type and ACCF validity bits to _SEGMENT_ENTRY_BITS and _SEGMENT_ENTRY_HARDWARE_BITS{,_LARGE}.

For completeness, introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE and _REGION3_ENTRY_HARDWARE_BITS, containing the hardware bits used for large puds and normal puds.

---
 arch/s390/include/asm/pgtable.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

...

Quoted 2 lines
arch/s390/include/asm/pgtable.h +2 -0
+#define _REGION3_ENTRY_HARDWARE_BITS_LARGE	0xffffffff8001073cUL
+#define _REGION3_ENTRY_HARDWARE_BITS		0xfffffffffffff6ffUL

...

arch/s390/include/asm/pgtable.h static inline int is_module_addr(void *addr) · line 285

Quoted 3 lines
arch/s390/include/asm/pgtable.h +3 -0
+#define _SEGMENT_ENTRY_BITS			0xfffffffffffffe3fUL
+#define _SEGMENT_ENTRY_HARDWARE_BITS		0xfffffffffffffe3cUL
+#define _SEGMENT_ENTRY_HARDWARE_BITS_LARGE	0xfffffffffff1073cUL

Please resend and make sure the order (BITS, BITS_LARGE, ...) is the same; then Alexander can pick this up.

For the definitions:

#4 lore raw

Re: [PATCH v3 2/2] s390/pgtable: add missing hardware bits for puds, pmds

Quoted 17 lines · On Mon, 29 Apr 2024 15:11:49 +0200 Heiko Carstens <[email protected]> wrote:
Quoted 11 lines · Claudio Imbrenda

Add the table type and ACCF validity bits to _SEGMENT_ENTRY_BITS and _SEGMENT_ENTRY_HARDWARE_BITS{,_LARGE}.

For completeness, introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE and _REGION3_ENTRY_HARDWARE_BITS, containing the hardware bits used for large puds and normal puds.

---
 arch/s390/include/asm/pgtable.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)  

...

Quoted 2 lines
arch/s390/include/asm/pgtable.h +2 -0
+#define _REGION3_ENTRY_HARDWARE_BITS_LARGE	0xffffffff8001073cUL
+#define _REGION3_ENTRY_HARDWARE_BITS		0xfffffffffffff6ffUL  

...

Quoted 6 lines

arch/s390/include/asm/pgtable.h static inline int is_module_addr(void *addr) · line 285

Quoted 3 lines
arch/s390/include/asm/pgtable.h +3 -0
+#define _SEGMENT_ENTRY_BITS			0xfffffffffffffe3fUL
+#define _SEGMENT_ENTRY_HARDWARE_BITS		0xfffffffffffffe3cUL
+#define _SEGMENT_ENTRY_HARDWARE_BITS_LARGE	0xfffffffffff1073cUL  

Please resend and make sure the order (BITS, BITS_LARGE, ...) is the same; then Alexander can pick this up.

oops, will fix

Quoted 3 lines

For the definitions: