Skip to content

Commit a984f27

Browse files
Alexander Gordeevhcahca
authored andcommitted
s390/mm: define Real Memory Copy size and mask macros
Make Real Memory Copy area size and mask explicit. This does not bring any functional change and only needed for clarity. Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 8ddccc8 commit a984f27

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

arch/s390/boot/startup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static unsigned long setup_kernel_memory_layout(void)
204204
/* force vmalloc and modules below kasan shadow */
205205
vmax = min(vmax, KASAN_SHADOW_START);
206206
#endif
207-
__memcpy_real_area = round_down(vmax - PAGE_SIZE, PAGE_SIZE);
207+
__memcpy_real_area = round_down(vmax - MEMCPY_REAL_SIZE, PAGE_SIZE);
208208
__abs_lowcore = round_down(__memcpy_real_area - ABS_LOWCORE_MAP_SIZE,
209209
sizeof(struct lowcore));
210210
MODULES_END = round_down(__abs_lowcore, _SEGMENT_SIZE);

arch/s390/include/asm/maccess.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include <linux/types.h>
66

7+
#define MEMCPY_REAL_SIZE PAGE_SIZE
8+
#define MEMCPY_REAL_MASK PAGE_MASK
9+
710
struct iov_iter;
811

912
extern unsigned long __memcpy_real_area;

arch/s390/mm/dump_pagetables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int pt_dump_init(void)
297297
address_markers[ABS_LOWCORE_NR].start_address = __abs_lowcore;
298298
address_markers[ABS_LOWCORE_END_NR].start_address = __abs_lowcore + ABS_LOWCORE_MAP_SIZE;
299299
address_markers[MEMCPY_REAL_NR].start_address = __memcpy_real_area;
300-
address_markers[MEMCPY_REAL_END_NR].start_address = __memcpy_real_area + PAGE_SIZE;
300+
address_markers[MEMCPY_REAL_END_NR].start_address = __memcpy_real_area + MEMCPY_REAL_SIZE;
301301
address_markers[VMEMMAP_NR].start_address = (unsigned long) vmemmap;
302302
address_markers[VMEMMAP_END_NR].start_address = (unsigned long)vmemmap + vmemmap_size;
303303
address_markers[VMALLOC_NR].start_address = VMALLOC_START;

arch/s390/mm/maccess.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ size_t memcpy_real_iter(struct iov_iter *iter, unsigned long src, size_t count)
8686
void *chunk;
8787
pte_t pte;
8888

89+
BUILD_BUG_ON(MEMCPY_REAL_SIZE != PAGE_SIZE);
8990
while (count) {
90-
phys = src & PAGE_MASK;
91-
offset = src & ~PAGE_MASK;
91+
phys = src & MEMCPY_REAL_MASK;
92+
offset = src & ~MEMCPY_REAL_MASK;
9293
chunk = (void *)(__memcpy_real_area + offset);
93-
len = min(count, PAGE_SIZE - offset);
94+
len = min(count, MEMCPY_REAL_SIZE - offset);
9495
pte = mk_pte_phys(phys, PAGE_KERNEL_RO);
9596

9697
mutex_lock(&memcpy_real_mutex);

0 commit comments

Comments
 (0)