]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390: Remove 2k vs 4k page table leftovers
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 10 Mar 2025 11:43:00 +0000 (12:43 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 18 Mar 2025 16:13:05 +0000 (17:13 +0100)
Since commit d08d4e7cd6bf ("s390/mm: use full 4KB page for 2KB PTE") always
4k page tables are allocated, however there is still some (now) obsolete
code left which deals with switching from 2k to 4k page tables for qemu/kvm
processes.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Remove the not needed code.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/Kconfig
arch/s390/include/asm/elf.h
arch/s390/include/asm/mmu.h
arch/s390/include/asm/mmu_context.h
arch/s390/include/asm/pgtable.h
arch/s390/include/asm/ptrace.h
arch/s390/include/asm/thread_info.h
arch/s390/kernel/syscall.c
arch/s390/mm/gmap.c

index acaa1d1c12b2f02414abcbea006aa9c6be1419e9..2cea7963e955462504dca7a4c410bfe7f5296e26 100644 (file)
@@ -73,7 +73,6 @@ config S390
        imply IMA_SECURE_AND_OR_TRUSTED_BOOT
        select ALTERNATE_USER_ADDRESS_SPACE
        select ARCH_32BIT_USTAT_F_TINODE
-       select ARCH_BINFMT_ELF_STATE
        select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
        select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
        select ARCH_ENABLE_MEMORY_HOTREMOVE
index 8f2c23cc52b61ba2584bf1ce56f10c3bf38c03eb..a03df312081ef93f95ab70ccb5a5d2bdf88d84ec 100644 (file)
@@ -158,9 +158,6 @@ enum {
 #define ELF_DATA       ELFDATA2MSB
 #define ELF_ARCH       EM_S390
 
-/* s390 specific phdr types */
-#define PT_S390_PGSTE  0x70000000
-
 /*
  * ELF register definitions..
  */
@@ -191,35 +188,6 @@ typedef s390_compat_regs compat_elf_gregset_t;
         && (x)->e_ident[EI_CLASS] == ELF_CLASS)
 #define compat_start_thread    start_thread31
 
-struct arch_elf_state {
-       int rc;
-};
-
-#define INIT_ARCH_ELF_STATE { .rc = 0 }
-
-#define arch_check_elf(ehdr, interp, interp_ehdr, state) (0)
-#ifdef CONFIG_PGSTE
-#define arch_elf_pt_proc(ehdr, phdr, elf, interp, state)       \
-({                                                             \
-       struct arch_elf_state *_state = state;                  \
-       if ((phdr)->p_type == PT_S390_PGSTE &&                  \
-           !page_table_allocate_pgste &&                       \
-           !test_thread_flag(TIF_PGSTE) &&                     \
-           !current->mm->context.alloc_pgste) {                \
-               set_thread_flag(TIF_PGSTE);                     \
-               set_pt_regs_flag(task_pt_regs(current),         \
-                                PIF_EXECVE_PGSTE_RESTART);     \
-               _state->rc = -EAGAIN;                           \
-       }                                                       \
-       _state->rc;                                             \
-})
-#else
-#define arch_elf_pt_proc(ehdr, phdr, elf, interp, state)       \
-({                                                             \
-       (state)->rc;                                            \
-})
-#endif
-
 /* For SVR4/S390 the function pointer to be registered with `atexit` is
    passed in R14. */
 #define ELF_PLAT_INIT(_r, load_addr) \
index 4c2dc7abc2858604954b5c33f472c87178ae2daf..f07e49b419abf82b3109db4de7c46641612e357a 100644 (file)
@@ -22,10 +22,7 @@ typedef struct {
         * The following bitfields need a down_write on the mm
         * semaphore when they are written to. As they are only
         * written once, they can be read without a lock.
-        *
-        * The mmu context allocates 4K page tables.
         */
-       unsigned int alloc_pgste:1;
        /* The mmu context uses extended page tables. */
        unsigned int has_pgste:1;
        /* The mmu context uses storage keys. */
index d56eb0a1f37bb8cf76990f30241d0182b4a66bb4..88f84beebb9e7d1dea35930b6c40c166089b13a3 100644 (file)
@@ -29,9 +29,6 @@ static inline int init_new_context(struct task_struct *tsk,
        mm->context.gmap_asce = 0;
        mm->context.flush_mm = 0;
 #ifdef CONFIG_PGSTE
-       mm->context.alloc_pgste = page_table_allocate_pgste ||
-               test_thread_flag(TIF_PGSTE) ||
-               (current->mm && current->mm->context.alloc_pgste);
        mm->context.has_pgste = 0;
        mm->context.uses_skeys = 0;
        mm->context.uses_cmm = 0;
index 01f14cf522554fbe66a850ef01cd9d10f962ebf8..f8a6b54986ecb6aa24393cca75e0afd5c2d5cacf 100644 (file)
@@ -584,15 +584,6 @@ static inline int mm_is_protected(struct mm_struct *mm)
        return 0;
 }
 
-static inline int mm_alloc_pgste(struct mm_struct *mm)
-{
-#ifdef CONFIG_PGSTE
-       if (unlikely(mm->context.alloc_pgste))
-               return 1;
-#endif
-       return 0;
-}
-
 static inline pgste_t clear_pgste_bit(pgste_t pgste, unsigned long mask)
 {
        return __pgste(pgste_val(pgste) & ~mask);
index 788bc4467445c9da9471cf5037bcf2887f1303e8..c66f3fc6daaf3f3f98473719bb40026e91c1b582 100644 (file)
 #include <asm/tpi.h>
 
 #define PIF_SYSCALL                    0       /* inside a system call */
-#define PIF_EXECVE_PGSTE_RESTART       1       /* restart execve for PGSTE binaries */
 #define PIF_SYSCALL_RET_SET            2       /* return value was set via ptrace */
 #define PIF_GUEST_FAULT                        3       /* indicates program check in sie64a */
 #define PIF_FTRACE_FULL_REGS           4       /* all register contents valid (ftrace) */
 
 #define _PIF_SYSCALL                   BIT(PIF_SYSCALL)
-#define _PIF_EXECVE_PGSTE_RESTART      BIT(PIF_EXECVE_PGSTE_RESTART)
 #define _PIF_SYSCALL_RET_SET           BIT(PIF_SYSCALL_RET_SET)
 #define _PIF_GUEST_FAULT               BIT(PIF_GUEST_FAULT)
 #define _PIF_FTRACE_FULL_REGS          BIT(PIF_FTRACE_FULL_REGS)
index c33f7144d1b978f612b8c092a4fd03fbacfc059e..1ad5e82c2f653fbfd216bdabdef862db2b04afdc 100644 (file)
@@ -67,7 +67,6 @@ void arch_setup_new_exec(void);
 #define TIF_NEED_RESCHED_LAZY  3       /* lazy rescheduling needed */
 #define TIF_UPROBE             4       /* breakpointed or single-stepping */
 #define TIF_PATCH_PENDING      5       /* pending live patching update */
-#define TIF_PGSTE              6       /* New mm's will use 4K page tables */
 #define TIF_NOTIFY_SIGNAL      7       /* signal notifications exist */
 #define TIF_GUARDED_STORAGE    8       /* load guarded storage control block */
 #define TIF_ISOLATE_BP_GUEST   9       /* Run KVM guests with isolated BP */
@@ -89,7 +88,6 @@ void arch_setup_new_exec(void);
 #define _TIF_NEED_RESCHED_LAZY BIT(TIF_NEED_RESCHED_LAZY)
 #define _TIF_UPROBE            BIT(TIF_UPROBE)
 #define _TIF_PATCH_PENDING     BIT(TIF_PATCH_PENDING)
-#define _TIF_PGSTE             BIT(TIF_PGSTE)
 #define _TIF_NOTIFY_SIGNAL     BIT(TIF_NOTIFY_SIGNAL)
 #define _TIF_GUARDED_STORAGE   BIT(TIF_GUARDED_STORAGE)
 #define _TIF_ISOLATE_BP_GUEST  BIT(TIF_ISOLATE_BP_GUEST)
index 535f3922ffa923102d8ca1c0d2eb3f37fb6a4dfe..4fee74553ca2d11c53d9b19eca7eefcd4447bea7 100644 (file)
@@ -121,11 +121,8 @@ void noinstr __do_syscall(struct pt_regs *regs, int per_trap)
        if (unlikely(test_and_clear_pt_regs_flag(regs, PIF_SYSCALL_RET_SET)))
                goto out;
        regs->gprs[2] = -ENOSYS;
-       if (unlikely(nr >= NR_syscalls))
-               goto out;
-       do {
+       if (likely(nr < NR_syscalls))
                regs->gprs[2] = current->thread.sys_call_table[nr](regs);
-       } while (test_and_clear_pt_regs_flag(regs, PIF_EXECVE_PGSTE_RESTART));
 out:
        syscall_exit_to_user_mode(regs);
 }
index 0d7cce4f3e8304e78ba77b81e0a47933fab418bf..f412a9af13d0fd4e23b315569fe74bbf6b9c7b7b 100644 (file)
@@ -2260,9 +2260,6 @@ int s390_enable_sie(void)
        /* Do we have pgstes? if yes, we are done */
        if (mm_has_pgste(mm))
                return 0;
-       /* Fail if the page tables are 2K */
-       if (!mm_alloc_pgste(mm))
-               return -EINVAL;
        mmap_write_lock(mm);
        mm->context.has_pgste = 1;
        /* split thp mappings and disable thp for future mappings */