]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
s390/mm: Rearrange region-third and segment table entry SW bits
authorGerald Schaefer <gerald.schaefer@linux.ibm.com>
Thu, 21 Nov 2024 17:45:20 +0000 (18:45 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 27 Nov 2024 11:55:20 +0000 (12:55 +0100)
Rearrange region-third and segment table entry SW bits, in order to
make room for future encoding of region/segment table swap entries.

Also adjust _SEGMENT_ENTRY_GMAP_UC and _SEGMENT_ENTRY_GMAP_IN bits in
gmap code. Those should only apply for gmap PMDs, and not really depend
on or conflict with host PMD bits, but for consistency also adjust them:
- _SEGMENT_ENTRY_GMAP_UC "dirty (migration)" was using the same bit as
  _SEGMENT_ENTRY_SOFT_DIRTY in the host PMD -> make it use the new
  SOFT_DIRTY bit 63 (0x0002)
- _SEGMENT_ENTRY_GMAP_IN "invalidation notify bit" was using 0x8000,
  which was an unused bit in the host PMD, that is now used for
  _SEGMENT_ENTRY_WRITE -> make it use bit 52 (0x0800) instead, which is
  still unused in the host PMD

This is a prerequisite for hugetlbfs PTE_MARKER support on s390, which
is needed to fix a regression introduced with commit 8a13897fb0da
("mm: userfaultfd: support UFFDIO_POISON for hugetlbfs"). That commit
depends on the availability of swap entries for hugetlbfs, which were
not available for s390 so far.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/gmap.h
arch/s390/include/asm/pgtable.h

index 64761c78f77471c42af06d925af48faa806e6610..13f51a6a5bb1bf42fb00b6de163c426150b03f8f 100644 (file)
@@ -17,8 +17,8 @@
 #define GMAP_NOTIFY_MPROT      0x1
 
 /* Status bits only for huge segment entries */
-#define _SEGMENT_ENTRY_GMAP_IN         0x8000  /* invalidation notify bit */
-#define _SEGMENT_ENTRY_GMAP_UC         0x4000  /* dirty (migration) */
+#define _SEGMENT_ENTRY_GMAP_IN         0x0800  /* invalidation notify bit */
+#define _SEGMENT_ENTRY_GMAP_UC         0x0002  /* dirty (migration) */
 
 /**
  * struct gmap_struct - guest address space
index 0ffbaf7419558b5afe6749e9cf28f49f04b60933..ee5d047a2d6705367c27bfd9c56a15d750c996ff 100644 (file)
@@ -286,11 +286,11 @@ 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_WRITE   0x0002  /* SW region write bit */
-#define _REGION3_ENTRY_READ    0x0001  /* SW region read bit */
+#define _REGION3_ENTRY_WRITE   0x8000  /* SW region write bit */
+#define _REGION3_ENTRY_READ    0x4000  /* SW region read bit */
 
 #ifdef CONFIG_MEM_SOFT_DIRTY
-#define _REGION3_ENTRY_SOFT_DIRTY 0x4000 /* SW region soft dirty bit */
+#define _REGION3_ENTRY_SOFT_DIRTY 0x0002 /* SW region soft dirty bit */
 #else
 #define _REGION3_ENTRY_SOFT_DIRTY 0x0000 /* SW region soft dirty bit */
 #endif
@@ -313,12 +313,13 @@ static inline int is_module_addr(void *addr)
 
 #define _SEGMENT_ENTRY_DIRTY   0x2000  /* SW segment dirty bit */
 #define _SEGMENT_ENTRY_YOUNG   0x1000  /* SW segment young bit */
+
 #define _SEGMENT_ENTRY_LARGE   0x0400  /* STE-format control, large page */
-#define _SEGMENT_ENTRY_WRITE   0x0002  /* SW segment write bit */
-#define _SEGMENT_ENTRY_READ    0x0001  /* SW segment read bit */
+#define _SEGMENT_ENTRY_WRITE   0x8000  /* SW segment write bit */
+#define _SEGMENT_ENTRY_READ    0x4000  /* SW segment read bit */
 
 #ifdef CONFIG_MEM_SOFT_DIRTY
-#define _SEGMENT_ENTRY_SOFT_DIRTY 0x4000 /* SW segment soft dirty bit */
+#define _SEGMENT_ENTRY_SOFT_DIRTY 0x0002 /* SW segment soft dirty bit */
 #else
 #define _SEGMENT_ENTRY_SOFT_DIRTY 0x0000 /* SW segment soft dirty bit */
 #endif