Skip to content

Commit 7706611

Browse files
committed
s390/mm: Rearrange region-third and segment table entry SW bits
JIRA: https://issues.redhat.com/browse/RHEL-74362 Tested: by me commit ae1b9fb Author: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Date: Thu Nov 21 18:45:20 2024 +0100 s390/mm: Rearrange region-third and segment table entry SW bits 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 8a13897 ("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> Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
1 parent 7a8c6bb commit 7706611

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

arch/s390/include/asm/gmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#define GMAP_NOTIFY_MPROT 0x1
1818

1919
/* Status bits only for huge segment entries */
20-
#define _SEGMENT_ENTRY_GMAP_IN 0x8000 /* invalidation notify bit */
21-
#define _SEGMENT_ENTRY_GMAP_UC 0x4000 /* dirty (migration) */
20+
#define _SEGMENT_ENTRY_GMAP_IN 0x0800 /* invalidation notify bit */
21+
#define _SEGMENT_ENTRY_GMAP_UC 0x0002 /* dirty (migration) */
2222

2323
/**
2424
* struct gmap_struct - guest address space

arch/s390/include/asm/pgtable.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ static inline int is_module_addr(void *addr)
266266
#define _REGION3_ENTRY_DIRTY 0x2000 /* SW region dirty bit */
267267
#define _REGION3_ENTRY_YOUNG 0x1000 /* SW region young bit */
268268
#define _REGION3_ENTRY_LARGE 0x0400 /* RTTE-format control, large page */
269-
#define _REGION3_ENTRY_WRITE 0x0002 /* SW region write bit */
270-
#define _REGION3_ENTRY_READ 0x0001 /* SW region read bit */
269+
#define _REGION3_ENTRY_WRITE 0x8000 /* SW region write bit */
270+
#define _REGION3_ENTRY_READ 0x4000 /* SW region read bit */
271271

272272
#ifdef CONFIG_MEM_SOFT_DIRTY
273-
#define _REGION3_ENTRY_SOFT_DIRTY 0x4000 /* SW region soft dirty bit */
273+
#define _REGION3_ENTRY_SOFT_DIRTY 0x0002 /* SW region soft dirty bit */
274274
#else
275275
#define _REGION3_ENTRY_SOFT_DIRTY 0x0000 /* SW region soft dirty bit */
276276
#endif
@@ -293,12 +293,13 @@ static inline int is_module_addr(void *addr)
293293

294294
#define _SEGMENT_ENTRY_DIRTY 0x2000 /* SW segment dirty bit */
295295
#define _SEGMENT_ENTRY_YOUNG 0x1000 /* SW segment young bit */
296+
296297
#define _SEGMENT_ENTRY_LARGE 0x0400 /* STE-format control, large page */
297-
#define _SEGMENT_ENTRY_WRITE 0x0002 /* SW segment write bit */
298-
#define _SEGMENT_ENTRY_READ 0x0001 /* SW segment read bit */
298+
#define _SEGMENT_ENTRY_WRITE 0x8000 /* SW segment write bit */
299+
#define _SEGMENT_ENTRY_READ 0x4000 /* SW segment read bit */
299300

300301
#ifdef CONFIG_MEM_SOFT_DIRTY
301-
#define _SEGMENT_ENTRY_SOFT_DIRTY 0x4000 /* SW segment soft dirty bit */
302+
#define _SEGMENT_ENTRY_SOFT_DIRTY 0x0002 /* SW segment soft dirty bit */
302303
#else
303304
#define _SEGMENT_ENTRY_SOFT_DIRTY 0x0000 /* SW segment soft dirty bit */
304305
#endif

0 commit comments

Comments
 (0)