]> Git Repo - linux.git/commitdiff
Merge tag 'riscv-for-linus-5.19-mw0' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <[email protected]>
Tue, 31 May 2022 21:10:54 +0000 (14:10 -0700)
committerLinus Torvalds <[email protected]>
Tue, 31 May 2022 21:10:54 +0000 (14:10 -0700)
Pull RISC-V updates from Palmer Dabbelt:

 - Support for the Svpbmt extension, which allows memory attributes to
   be encoded in pages

 - Support for the Allwinner D1's implementation of page-based memory
   attributes

 - Support for running rv32 binaries on rv64 systems, via the compat
   subsystem

 - Support for kexec_file()

 - Support for the new generic ticket-based spinlocks, which allows us
   to also move to qrwlock. These should have already gone in through
   the asm-geneic tree as well

 - A handful of cleanups and fixes, include some larger ones around
   atomics and XIP

* tag 'riscv-for-linus-5.19-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (51 commits)
  RISC-V: Prepare dropping week attribute from arch_kexec_apply_relocations[_add]
  riscv: compat: Using seperated vdso_maps for compat_vdso_info
  RISC-V: Fix the XIP build
  RISC-V: Split out the XIP fixups into their own file
  RISC-V: ignore xipImage
  RISC-V: Avoid empty create_*_mapping definitions
  riscv: Don't output a bogus mmu-type on a no MMU kernel
  riscv: atomic: Add custom conditional atomic operation implementation
  riscv: atomic: Optimize dec_if_positive functions
  riscv: atomic: Cleanup unnecessary definition
  RISC-V: Load purgatory in kexec_file
  RISC-V: Add purgatory
  RISC-V: Support for kexec_file on panic
  RISC-V: Add kexec_file support
  RISC-V: use memcpy for kexec_file mode
  kexec_file: Fix kexec_file.c build error for riscv platform
  riscv: compat: Add COMPAT Kbuild skeletal support
  riscv: compat: ptrace: Add compat_arch_ptrace implement
  riscv: compat: signal: Add rt_frame implementation
  riscv: add memory-type errata for T-Head
  ...

24 files changed:
1  2 
arch/arm64/Kconfig
arch/mips/Kconfig
arch/parisc/Kconfig
arch/parisc/include/asm/unistd.h
arch/powerpc/Kconfig
arch/riscv/Kconfig
arch/riscv/Kconfig.socs
arch/riscv/Makefile
arch/riscv/include/asm/csr.h
arch/riscv/include/asm/pgtable-64.h
arch/riscv/include/asm/pgtable.h
arch/riscv/mm/init.c
arch/s390/Kconfig
arch/s390/include/asm/compat.h
arch/sparc/Kconfig
arch/x86/Kconfig
arch/x86/include/asm/compat.h
fs/open.c
fs/stat.c
include/linux/compat.h
include/linux/kexec.h
init/Kconfig
kernel/kexec_file.c
mm/readahead.c

diff --combined arch/arm64/Kconfig
index a4968845e67f5e14fb4b65eb7c0bc0ae7276cf25,ff674808681a93f81afa9bf95c132a4d51eb8c5b..1652a9800ebee645616948df2249e186e948baff
@@@ -45,7 -45,6 +45,7 @@@ config ARM6
        select ARCH_HAS_SYSCALL_WRAPPER
        select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 +      select ARCH_HAS_VM_GET_PAGE_PROT
        select ARCH_HAS_ZONE_DMA_SET if EXPERT
        select ARCH_HAVE_ELF_PROT
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_SUPPORTS_ATOMIC_RMW
        select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
        select ARCH_SUPPORTS_NUMA_BALANCING
 +      select ARCH_SUPPORTS_PAGE_TABLE_CHECK
        select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
        select ARCH_WANT_DEFAULT_BPF_JIT
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
 +      select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
        select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_WANTS_NO_INSTR
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_CONTIGUOUS
        select HAVE_DYNAMIC_FTRACE
 -      select HAVE_DYNAMIC_FTRACE_WITH_REGS \
 -              if $(cc-option,-fpatchable-function-entry=2)
        select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \
                if DYNAMIC_FTRACE_WITH_REGS
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
        help
          ARM 64-bit (AArch64) Linux support.
  
 +config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
 +      def_bool CC_IS_CLANG
 +      # https://github.com/ClangBuiltLinux/linux/issues/1507
 +      depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
 +      select HAVE_DYNAMIC_FTRACE_WITH_REGS
 +
 +config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
 +      def_bool CC_IS_GCC
 +      depends on $(cc-option,-fpatchable-function-entry=2)
 +      select HAVE_DYNAMIC_FTRACE_WITH_REGS
 +
  config 64BIT
        def_bool y
  
@@@ -265,31 -253,31 +265,31 @@@ config ARM64_CONT_PMD_SHIF
        default 4
  
  config ARCH_MMAP_RND_BITS_MIN
 -       default 14 if ARM64_64K_PAGES
 -       default 16 if ARM64_16K_PAGES
 -       default 18
 +      default 14 if ARM64_64K_PAGES
 +      default 16 if ARM64_16K_PAGES
 +      default 18
  
  # max bits determined by the following formula:
  #  VA_BITS - PAGE_SHIFT - 3
  config ARCH_MMAP_RND_BITS_MAX
 -       default 19 if ARM64_VA_BITS=36
 -       default 24 if ARM64_VA_BITS=39
 -       default 27 if ARM64_VA_BITS=42
 -       default 30 if ARM64_VA_BITS=47
 -       default 29 if ARM64_VA_BITS=48 && ARM64_64K_PAGES
 -       default 31 if ARM64_VA_BITS=48 && ARM64_16K_PAGES
 -       default 33 if ARM64_VA_BITS=48
 -       default 14 if ARM64_64K_PAGES
 -       default 16 if ARM64_16K_PAGES
 -       default 18
 +      default 19 if ARM64_VA_BITS=36
 +      default 24 if ARM64_VA_BITS=39
 +      default 27 if ARM64_VA_BITS=42
 +      default 30 if ARM64_VA_BITS=47
 +      default 29 if ARM64_VA_BITS=48 && ARM64_64K_PAGES
 +      default 31 if ARM64_VA_BITS=48 && ARM64_16K_PAGES
 +      default 33 if ARM64_VA_BITS=48
 +      default 14 if ARM64_64K_PAGES
 +      default 16 if ARM64_16K_PAGES
 +      default 18
  
  config ARCH_MMAP_RND_COMPAT_BITS_MIN
 -       default 7 if ARM64_64K_PAGES
 -       default 9 if ARM64_16K_PAGES
 -       default 11
 +      default 7 if ARM64_64K_PAGES
 +      default 9 if ARM64_16K_PAGES
 +      default 11
  
  config ARCH_MMAP_RND_COMPAT_BITS_MAX
 -       default 16
 +      default 16
  
  config NO_IOPORT_MAP
        def_bool y if !PCI
@@@ -316,7 -304,7 +316,7 @@@ config GENERIC_HWEIGH
        def_bool y
  
  config GENERIC_CSUM
 -        def_bool y
 +      def_bool y
  
  config GENERIC_CALIBRATE_DELAY
        def_bool y
@@@ -690,7 -678,7 +690,7 @@@ config ARM64_ERRATUM_205167
        default y
        help
          This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678.
 -        Affected Coretex-A510 might not respect the ordering rules for
 +        Affected Cortex-A510 might not respect the ordering rules for
          hardware update of the page table's dirty bit. The workaround
          is to not enable the feature on affected CPUs.
  
@@@ -1049,7 -1037,8 +1049,7 @@@ config SOCIONEXT_SYNQUACER_PREIT
  
          If unsure, say Y.
  
 -endmenu
 -
 +endmenu # "ARM errata workarounds via the alternatives framework"
  
  choice
        prompt "Page size"
@@@ -1577,9 -1566,9 +1577,9 @@@ config SETEND_EMULATIO
          be unexpected results in the applications.
  
          If unsure, say Y
 -endif
 +endif # ARMV8_DEPRECATED
  
 -endif
 +endif # COMPAT
  
  menu "ARMv8.1 architectural features"
  
@@@ -1604,15 -1593,15 +1604,15 @@@ config ARM64_PA
        bool "Enable support for Privileged Access Never (PAN)"
        default y
        help
 -       Privileged Access Never (PAN; part of the ARMv8.1 Extensions)
 -       prevents the kernel or hypervisor from accessing user-space (EL0)
 -       memory directly.
 +        Privileged Access Never (PAN; part of the ARMv8.1 Extensions)
 +        prevents the kernel or hypervisor from accessing user-space (EL0)
 +        memory directly.
  
 -       Choosing this option will cause any unprotected (not using
 -       copy_to_user et al) memory access to fail with a permission fault.
 +        Choosing this option will cause any unprotected (not using
 +        copy_to_user et al) memory access to fail with a permission fault.
  
 -       The feature is detected at runtime, and will remain as a 'nop'
 -       instruction if the cpu does not implement the feature.
 +        The feature is detected at runtime, and will remain as a 'nop'
 +        instruction if the cpu does not implement the feature.
  
  config AS_HAS_LDAPR
        def_bool $(as-instr,.arch_extension rcpc)
@@@ -1640,15 -1629,15 +1640,15 @@@ config ARM64_USE_LSE_ATOMIC
          built with binutils >= 2.25 in order for the new instructions
          to be used.
  
 -endmenu
 +endmenu # "ARMv8.1 architectural features"
  
  menu "ARMv8.2 architectural features"
  
  config AS_HAS_ARMV8_2
 -       def_bool $(cc-option,-Wa$(comma)-march=armv8.2-a)
 +      def_bool $(cc-option,-Wa$(comma)-march=armv8.2-a)
  
  config AS_HAS_SHA3
 -       def_bool $(as-instr,.arch armv8.2-a+sha3)
 +      def_bool $(as-instr,.arch armv8.2-a+sha3)
  
  config ARM64_PMEM
        bool "Enable support for persistent memory"
@@@ -1692,7 -1681,7 +1692,7 @@@ config ARM64_CN
          at runtime, and does not affect PEs that do not implement
          this feature.
  
 -endmenu
 +endmenu # "ARMv8.2 architectural features"
  
  menu "ARMv8.3 architectural features"
  
@@@ -1755,7 -1744,7 +1755,7 @@@ config AS_HAS_PA
  config AS_HAS_CFI_NEGATE_RA_STATE
        def_bool $(as-instr,.cfi_startproc\n.cfi_negate_ra_state\n.cfi_endproc\n)
  
 -endmenu
 +endmenu # "ARMv8.3 architectural features"
  
  menu "ARMv8.4 architectural features"
  
@@@ -1796,7 -1785,7 +1796,7 @@@ config ARM64_TLB_RANG
          The feature introduces new assembly instructions, and they were
          support when binutils >= 2.30.
  
 -endmenu
 +endmenu # "ARMv8.4 architectural features"
  
  menu "ARMv8.5 architectural features"
  
@@@ -1882,7 -1871,6 +1882,7 @@@ config ARM64_MT
        depends on AS_HAS_LSE_ATOMICS
        # Required for tag checking in the uaccess routines
        depends on ARM64_PAN
 +      select ARCH_HAS_SUBPAGE_FAULTS
        select ARCH_USES_HIGH_VMA_FLAGS
        help
          Memory Tagging (part of the ARMv8.5 Extensions) provides
  
          Documentation/arm64/memory-tagging-extension.rst.
  
 -endmenu
 +endmenu # "ARMv8.5 architectural features"
  
  menu "ARMv8.7 architectural features"
  
@@@ -1913,12 -1901,12 +1913,12 @@@ config ARM64_EPA
        default y
        depends on ARM64_PAN
        help
 -       Enhanced Privileged Access Never (EPAN) allows Privileged
 -       Access Never to be used with Execute-only mappings.
 +        Enhanced Privileged Access Never (EPAN) allows Privileged
 +        Access Never to be used with Execute-only mappings.
  
 -       The feature is detected at runtime, and will remain disabled
 -       if the cpu does not implement the feature.
 -endmenu
 +        The feature is detected at runtime, and will remain disabled
 +        if the cpu does not implement the feature.
 +endmenu # "ARMv8.7 architectural features"
  
  config ARM64_SVE
        bool "ARM Scalable Vector Extension support"
          booting the kernel.  If unsure and you are not observing these
          symptoms, you should assume that it is safe to say Y.
  
 +config ARM64_SME
 +      bool "ARM Scalable Matrix Extension support"
 +      default y
 +      depends on ARM64_SVE
 +      help
 +        The Scalable Matrix Extension (SME) is an extension to the AArch64
 +        execution state which utilises a substantial subset of the SVE
 +        instruction set, together with the addition of new architectural
 +        register state capable of holding two dimensional matrix tiles to
 +        enable various matrix operations.
 +
  config ARM64_MODULE_PLTS
        bool "Use PLTs to allow module memory to spill over into vmalloc area"
        depends on MODULES
@@@ -2005,7 -1982,7 +2005,7 @@@ config ARM64_DEBUG_PRIORITY_MASKIN
          the validity of ICC_PMR_EL1 when calling concerned functions.
  
          If unsure, say N
 -endif
 +endif # ARM64_PSEUDO_NMI
  
  config RELOCATABLE
        bool "Build a relocatable kernel image" if EXPERT
@@@ -2064,19 -2041,7 +2064,19 @@@ config STACKPROTECTOR_PER_TAS
        def_bool y
        depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
  
 -endmenu
 +# The GPIO number here must be sorted by descending number. In case of
 +# a multiplatform kernel, we just want the highest value required by the
 +# selected platforms.
 +config ARCH_NR_GPIO
 +        int
 +        default 2048 if ARCH_APPLE
 +        default 0
 +        help
 +          Maximum number of GPIOs in the system.
 +
 +          If unsure, leave the default value.
 +
 +endmenu # "Kernel Features"
  
  menu "Boot options"
  
@@@ -2140,7 -2105,7 +2140,7 @@@ config EF
        help
          This option provides support for runtime services provided
          by UEFI firmware (such as non-volatile variables, realtime
 -          clock, and platform reset). A UEFI stub is also provided to
 +        clock, and platform reset). A UEFI stub is also provided to
          allow the kernel to be booted as an EFI application. This
          is only useful on systems that have UEFI firmware.
  
@@@ -2155,12 -2120,8 +2155,8 @@@ config DM
          However, even with this option, the resultant kernel should
          continue to boot on existing non-UEFI platforms.
  
 -endmenu
 +endmenu # "Boot options"
  
- config SYSVIPC_COMPAT
-       def_bool y
-       depends on COMPAT && SYSVIPC
  menu "Power management options"
  
  source "kernel/power/Kconfig"
@@@ -2176,7 -2137,7 +2172,7 @@@ config ARCH_HIBERNATION_HEADE
  config ARCH_SUSPEND_POSSIBLE
        def_bool y
  
 -endmenu
 +endmenu # "Power management options"
  
  menu "CPU Power Management"
  
@@@ -2184,7 -2145,7 +2180,7 @@@ source "drivers/cpuidle/Kconfig
  
  source "drivers/cpufreq/Kconfig"
  
 -endmenu
 +endmenu # "CPU Power Management"
  
  source "drivers/acpi/Kconfig"
  
@@@ -2192,4 -2153,4 +2188,4 @@@ source "arch/arm64/kvm/Kconfig
  
  if CRYPTO
  source "arch/arm64/crypto/Kconfig"
 -endif
 +endif # CRYPTO
diff --combined arch/mips/Kconfig
index 6e92ca97e47974d5312411ebfea9c6e16e8a038a,0055482cd20f1afc3dc93961b03c5c0e5f7bbee7..db09d45d59ec751486224f3af38524d0875ed3a0
@@@ -1321,11 -1321,11 +1321,11 @@@ config CPU_LOONGSON6
        select SWIOTLB
        select HAVE_KVM
        help
 -              The Loongson GSx64(GS264/GS464/GS464E/GS464V) series of processor
 -              cores implements the MIPS64R2 instruction set with many extensions,
 -              including most 64-bit Loongson-2 (2H, 2K) and Loongson-3 (3A1000,
 -              3B1000, 3B1500, 3A2000, 3A3000 and 3A4000) processors. However, old
 -              Loongson-2E/2F is not covered here and will be removed in future.
 +        The Loongson GSx64(GS264/GS464/GS464E/GS464V) series of processor
 +        cores implements the MIPS64R2 instruction set with many extensions,
 +        including most 64-bit Loongson-2 (2H, 2K) and Loongson-3 (3A1000,
 +        3B1000, 3B1500, 3A2000, 3A3000 and 3A4000) processors. However, old
 +        Loongson-2E/2F is not covered here and will be removed in future.
  
  config LOONGSON3_ENHANCEMENT
        bool "New Loongson-3 CPU Enhancements"
@@@ -3198,16 -3198,12 +3198,12 @@@ config MIPS32_COMPA
  config COMPAT
        bool
  
- config SYSVIPC_COMPAT
-       bool
  config MIPS32_O32
        bool "Kernel support for o32 binaries"
        depends on 64BIT
        select ARCH_WANT_OLD_COMPAT_IPC
        select COMPAT
        select MIPS32_COMPAT
-       select SYSVIPC_COMPAT if SYSVIPC
        help
          Select this option if you want to run o32 binaries.  These are pure
          32-bit binaries as used by the 32-bit Linux/MIPS port.  Most of
@@@ -3221,7 -3217,6 +3217,6 @@@ config MIPS32_N3
        select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
        select COMPAT
        select MIPS32_COMPAT
-       select SYSVIPC_COMPAT if SYSVIPC
        help
          Select this option if you want to run n32 binaries.  These are
          64-bit binaries using 32-bit quantities for addressing and certain
@@@ -3255,7 -3250,7 +3250,7 @@@ menu "CPU Power Management
  
  if CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
  source "drivers/cpufreq/Kconfig"
 -endif
 +endif # CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
  
  source "drivers/cpuidle/Kconfig"
  
diff --combined arch/parisc/Kconfig
index bd22578859d0024c72ba913bc88614c4d0fa7b72,93cb07a4446fdf5ceeb8c0db8bf700a4c10b8d33..5f2448dc5a2b2ee77e08f7b3b470273eff388cf4
@@@ -38,7 -38,6 +38,7 @@@ config PARIS
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_ARCH_TOPOLOGY if SMP
 +      select GENERIC_CPU_DEVICES if !SMP
        select GENERIC_LIB_DEVMEM_IS_ALLOWED
        select SYSCTL_ARCH_UNALIGN_ALLOW
        select SYSCTL_EXCEPTION_TRACE
@@@ -332,10 -331,6 +332,6 @@@ config COMPA
        def_bool y
        depends on 64BIT
  
- config SYSVIPC_COMPAT
-       def_bool y
-       depends on COMPAT && SYSVIPC
  config AUDIT_ARCH
        def_bool y
  
index c033e427838f4138bbfe64131cd8885832bb600d,81cbad73b517f2e49015d1e99ff7c908c0c89bbc..e38f9a90ac154c2d7296ed2a75d2e9ed6b3d7453
@@@ -142,6 -142,7 +142,6 @@@ type name(type1 arg1, type2 arg2, type
  }
  
  #define __ARCH_WANT_NEW_STAT
 -#define __ARCH_WANT_OLD_READDIR
  #define __ARCH_WANT_STAT64
  #define __ARCH_WANT_SYS_ALARM
  #define __ARCH_WANT_SYS_GETHOSTNAME
  #define __ARCH_WANT_SYS_FADVISE64
  #define __ARCH_WANT_SYS_GETPGRP
  #define __ARCH_WANT_SYS_NICE
 -#define __ARCH_WANT_SYS_OLDUMOUNT
  #define __ARCH_WANT_SYS_SIGPENDING
  #define __ARCH_WANT_SYS_SIGPROCMASK
  #define __ARCH_WANT_SYS_FORK
  #define __ARCH_WANT_SYS_CLONE
  #define __ARCH_WANT_SYS_CLONE3
  #define __ARCH_WANT_COMPAT_SYS_SENDFILE
+ #define __ARCH_WANT_COMPAT_STAT
  
  #ifdef CONFIG_64BIT
  #define __ARCH_WANT_SYS_TIME
diff --combined arch/powerpc/Kconfig
index 3eaddb8997a92f5fa4f377bab3077e92d9dbd295,6edb294a34efd85692adac790e96b98b3de45054..be68c1f02b794b169da802fb7be41395e07df655
@@@ -109,7 -109,6 +109,7 @@@ config PP
        # Please keep this list sorted alphabetically.
        #
        select ARCH_32BIT_OFF_T if PPC32
 +      select ARCH_DISABLE_KASAN_INLINE        if PPC_RADIX_MMU
        select ARCH_ENABLE_MEMORY_HOTPLUG
        select ARCH_ENABLE_MEMORY_HOTREMOVE
        select ARCH_HAS_COPY_MC                 if PPC64
        select ARCH_HAS_DEBUG_WX                if STRICT_KERNEL_RWX
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_DMA_MAP_DIRECT          if PPC_PSERIES
 -      select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_FORTIFY_SOURCE
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_HUGEPD                  if HUGETLB_PAGE
        select ARCH_HAS_TICK_BROADCAST          if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_HAS_UACCESS_FLUSHCACHE
        select ARCH_HAS_UBSAN_SANITIZE_ALL
 +      select ARCH_HAS_VM_GET_PAGE_PROT        if PPC_BOOK3S_64
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_KEEP_MEMBLOCK
        select ARCH_MIGHT_HAVE_PC_PARPORT
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS          if PPC_QUEUED_SPINLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS        if PPC_QUEUED_SPINLOCKS
 +      select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
        select ARCH_WANT_IPC_PARSE_VERSION
        select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
        select ARCH_WANT_LD_ORPHAN_WARN
 +      select ARCH_WANTS_MODULES_DATA_IN_VMALLOC       if PPC_BOOK3S_32 || PPC_8xx
 +      select ARCH_WANTS_NO_INSTR
        select ARCH_WEAK_RELEASE_ACQUIRE
        select BINFMT_ELF
        select BUILDTIME_TABLE_SORT
        select HAVE_ARCH_JUMP_LABEL
        select HAVE_ARCH_JUMP_LABEL_RELATIVE
        select HAVE_ARCH_KASAN                  if PPC32 && PPC_PAGE_SHIFT <= 14
 -      select HAVE_ARCH_KASAN_VMALLOC          if PPC32 && PPC_PAGE_SHIFT <= 14
 +      select HAVE_ARCH_KASAN                  if PPC_RADIX_MMU
 +      select HAVE_ARCH_KASAN_VMALLOC          if HAVE_ARCH_KASAN
        select HAVE_ARCH_KFENCE                 if PPC_BOOK3S_32 || PPC_8xx || 40x
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_MMAP_RND_BITS
        select HAVE_EFFICIENT_UNALIGNED_ACCESS  if !(CPU_LITTLE_ENDIAN && POWER7_CPU)
        select HAVE_FAST_GUP
        select HAVE_FTRACE_MCOUNT_RECORD
 -      select HAVE_FUNCTION_DESCRIPTORS        if PPC64 && !CPU_LITTLE_ENDIAN
 +      select HAVE_FUNCTION_DESCRIPTORS        if PPC64_ELF_ABI_V1
        select HAVE_FUNCTION_ERROR_INJECTION
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_TRACER
@@@ -303,11 -298,6 +303,6 @@@ config COMPA
        select ARCH_WANT_OLD_COMPAT_IPC
        select COMPAT_OLD_SIGACTION
  
- config SYSVIPC_COMPAT
-       bool
-       depends on COMPAT && SYSVIPC
-       default y
  config SCHED_OMIT_FRAME_POINTER
        bool
        default y
@@@ -571,6 -561,7 +566,6 @@@ config RELOCATABL
        bool "Build a relocatable kernel"
        depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE))
        select NONSTATIC_KERNEL
 -      select MODULE_REL_CRCS if MODVERSIONS
        help
          This builds a kernel image that is capable of running at the
          location the kernel is loaded at. For ppc32, there is no any
@@@ -763,22 -754,6 +758,22 @@@ config PPC_256K_PAGE
  
  endchoice
  
 +config PAGE_SIZE_4KB
 +      def_bool y
 +      depends on PPC_4K_PAGES
 +
 +config PAGE_SIZE_16KB
 +      def_bool y
 +      depends on PPC_16K_PAGES
 +
 +config PAGE_SIZE_64KB
 +      def_bool y
 +      depends on PPC_64K_PAGES
 +
 +config PAGE_SIZE_256KB
 +      def_bool y
 +      depends on PPC_256K_PAGES
 +
  config PPC_PAGE_SHIFT
        int
        default 18 if PPC_256K_PAGES
diff --combined arch/riscv/Kconfig
index c0853f1474a7088947daea5593e827b1434c8fee,f863065b478c6786346441367c56261a9cd08f99..905e550e0fd3b49f43bfd10c902047e347697955
@@@ -38,7 -38,6 +38,7 @@@ config RISC
        select ARCH_SUPPORTS_ATOMIC_RMW
        select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
        select ARCH_SUPPORTS_HUGETLBFS if MMU
 +      select ARCH_SUPPORTS_PAGE_TABLE_CHECK
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
@@@ -78,6 -77,7 +78,7 @@@
        select HAVE_ARCH_KGDB if !XIP_KERNEL
        select HAVE_ARCH_KGDB_QXFER_PKT
        select HAVE_ARCH_MMAP_RND_BITS if MMU
+       select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
@@@ -129,12 -129,18 +130,18 @@@ config ARCH_MMAP_RND_BITS_MI
        default 18 if 64BIT
        default 8
  
+ config ARCH_MMAP_RND_COMPAT_BITS_MIN
+       default 8
  # max bits determined by the following formula:
  #  VA_BITS - PAGE_SHIFT - 3
  config ARCH_MMAP_RND_BITS_MAX
        default 24 if 64BIT # SV39 based
        default 17
  
+ config ARCH_MMAP_RND_COMPAT_BITS_MAX
+       default 17
  # set if we run in machine mode, cleared if we run in supervisor mode
  config RISCV_M_MODE
        bool
@@@ -326,6 -332,21 +333,21 @@@ config NODES_SHIF
          Specify the maximum number of NUMA Nodes available on the target
          system.  Increases memory reserved to accommodate various tables.
  
+ config RISCV_ALTERNATIVE
+       bool
+       depends on !XIP_KERNEL
+       help
+         This Kconfig allows the kernel to automatically patch the
+         errata required by the execution platform at run time. The
+         code patching is performed once in the boot stages. It means
+         that the overhead from this mechanism is just taken once.
+ config RISCV_ALTERNATIVE_EARLY
+       bool
+       depends on RISCV_ALTERNATIVE
+       help
+         Allows early patching of the kernel for special errata
  config RISCV_ISA_C
        bool "Emit compressed instructions when building Linux"
        default y
  
           If you don't know what to do here, say Y.
  
+ config RISCV_ISA_SVPBMT
+       bool "SVPBMT extension support"
+       depends on 64BIT && MMU
+       select RISCV_ALTERNATIVE
+       default y
+       help
+          Adds support to dynamically detect the presence of the SVPBMT extension
+          (Supervisor-mode: page-based memory types) and enable its usage.
+          The SVPBMT extension is only available on 64Bit cpus.
+          If you don't know what to do here, say Y.
  config FPU
        bool "FPU support"
        default y
@@@ -385,6 -419,26 +420,26 @@@ config KEXE
  
          The name comes from the similarity to the exec system call.
  
+ config KEXEC_FILE
+       bool "kexec file based systmem call"
+       select KEXEC_CORE
+       select KEXEC_ELF
+       select HAVE_IMA_KEXEC if IMA
+       depends on 64BIT
+       help
+         This is new version of kexec system call. This system call is
+         file based and takes file descriptors as system call argument
+         for kernel and initramfs as opposed to list of segments as
+         accepted by previous system call.
+         If you don't know what to do here, say Y.
+ config ARCH_HAS_KEXEC_PURGATORY
+       def_bool KEXEC_FILE
+       select BUILD_BIN2C
+       depends on CRYPTO=y
+       depends on CRYPTO_SHA256=y
  config CRASH_DUMP
        bool "Build kdump crash kernel"
        help
  
          For more details see Documentation/admin-guide/kdump/kdump.rst
  
+ config COMPAT
+       bool "Kernel support for 32-bit U-mode"
+       default 64BIT
+       depends on 64BIT && MMU
+       help
+         This option enables support for a 32-bit U-mode running under a 64-bit
+         kernel at S-mode. riscv32-specific components such as system calls,
+         the user helper functions (vdso), signal rt_frame functions and the
+         ptrace interface are handled appropriately by the kernel.
+         If you want to execute 32-bit userspace applications, say Y.
  endmenu
  
  menu "Boot options"
@@@ -470,7 -536,7 +537,7 @@@ config CC_HAVE_STACKPROTECTOR_TL
  
  config STACKPROTECTOR_PER_TASK
        def_bool y
 -      depends on !GCC_PLUGIN_RANDSTRUCT
 +      depends on !RANDSTRUCT
        depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
  
  config PHYS_RAM_BASE_FIXED
diff --combined arch/riscv/Kconfig.socs
index f6ef358d8a2cf6eb628a054ef96794a682a12d3d,41c0a6e9b0bf0e09c305cf7010222e0a9feafca5..85670dc9fe95d5779df78b733668429cb3bc9775
@@@ -14,7 -14,6 +14,6 @@@ config SOC_SIFIV
        select CLK_SIFIVE
        select CLK_SIFIVE_PRCI
        select SIFIVE_PLIC
-       select RISCV_ERRATA_ALTERNATIVE if !XIP_KERNEL
        select ERRATA_SIFIVE if !XIP_KERNEL
        help
          This enables support for SiFive SoC platform hardware.
@@@ -38,7 -37,7 +37,7 @@@ config SOC_VIR
        select SIFIVE_PLIC
        select PM_GENERIC_DOMAINS if PM
        select PM_GENERIC_DOMAINS_OF if PM && OF
 -      select RISCV_SBI_CPUIDLE if CPU_IDLE
 +      select RISCV_SBI_CPUIDLE if CPU_IDLE && RISCV_SBI
        help
          This enables support for QEMU Virt Machine.
  
diff --combined arch/riscv/Makefile
index 2b93ca9f4fc3a324cba0747ff933fb544306c538,c4228c5d155e0d6efe0c4dee0275dcd4883c5589..e3b1d06e4db1d93b6f4d30702bc7fc8104fdae14
@@@ -103,7 -103,7 +103,7 @@@ endi
  
  head-y := arch/riscv/kernel/head.o
  
- core-$(CONFIG_RISCV_ERRATA_ALTERNATIVE) += arch/riscv/errata/
+ core-y += arch/riscv/errata/
  core-$(CONFIG_KVM) += arch/riscv/kvm/
  
  libs-y += arch/riscv/lib/
@@@ -112,12 -112,17 +112,17 @@@ libs-$(CONFIG_EFI_STUB) += $(objtree)/d
  PHONY += vdso_install
  vdso_install:
        $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@
+       $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \
+               $(build)=arch/riscv/kernel/compat_vdso $@)
  
  ifeq ($(KBUILD_EXTMOD),)
  ifeq ($(CONFIG_MMU),y)
  prepare: vdso_prepare
  vdso_prepare: prepare0
        $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso include/generated/vdso-offsets.h
+       $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \
+               $(build)=arch/riscv/kernel/compat_vdso include/generated/compat_vdso-offsets.h)
  endif
  endif
  
@@@ -139,10 -144,11 +144,10 @@@ $(BOOT_TARGETS): vmlinu
  Image.%: Image
        $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  
 -install: install-image = Image
 -zinstall: install-image = Image.gz
 +install: KBUILD_IMAGE := $(boot)/Image
 +zinstall: KBUILD_IMAGE := $(boot)/Image.gz
  install zinstall:
 -      $(CONFIG_SHELL) $(srctree)/$(boot)/install.sh $(KERNELRELEASE) \
 -      $(boot)/$(install-image) System.map "$(INSTALL_PATH)"
 +      $(call cmd,install)
  
  PHONY += rv32_randconfig
  rv32_randconfig:
@@@ -153,3 -159,7 +158,7 @@@ PHONY += rv64_randconfi
  rv64_randconfig:
        $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/riscv/configs/64-bit.config \
                -f $(srctree)/Makefile randconfig
+ PHONY += rv32_defconfig
+ rv32_defconfig:
+       $(Q)$(MAKE) -f $(srctree)/Makefile defconfig 32-bit.config
index cc40521e438b32147767393fc9b96eed0610a754,f5d1251fd6c71d2a91d49d563429e23586506dec..6d85655e7edf26aabfe4b8345a3d95851fd8a87b
  #define SR_SD         _AC(0x8000000000000000, UL) /* FS/XS dirty */
  #endif
  
+ #ifdef CONFIG_64BIT
+ #define SR_UXL                _AC(0x300000000, UL) /* XLEN mask for U-mode */
+ #define SR_UXL_32     _AC(0x100000000, UL) /* XLEN = 32 for U-mode */
+ #define SR_UXL_64     _AC(0x200000000, UL) /* XLEN = 64 for U-mode */
+ #define SR_UXL_SHIFT  32
+ #endif
  /* SATP flags */
  #ifndef CONFIG_64BIT
  #define SATP_PPN      _AC(0x003FFFFF, UL)
  #define HGATP_MODE_SV32X4     _AC(1, UL)
  #define HGATP_MODE_SV39X4     _AC(8, UL)
  #define HGATP_MODE_SV48X4     _AC(9, UL)
 +#define HGATP_MODE_SV57X4     _AC(10, UL)
  
  #define HGATP32_MODE_SHIFT    31
  #define HGATP32_VMID_SHIFT    22
index ba2494cbc24f91245fdda6525c320bd1da5a05b4,e4ff3e0ab8873889acd67490867395e721e8177b..5c2aba5efbd0ecf4ff302af06f016e3fa55b36bf
@@@ -6,7 -6,9 +6,9 @@@
  #ifndef _ASM_RISCV_PGTABLE_64_H
  #define _ASM_RISCV_PGTABLE_64_H
  
+ #include <linux/bits.h>
  #include <linux/const.h>
+ #include <asm/errata_list.h>
  
  extern bool pgtable_l4_enabled;
  extern bool pgtable_l5_enabled;
@@@ -65,6 -67,71 +67,71 @@@ typedef struct 
  
  #define PTRS_PER_PMD    (PAGE_SIZE / sizeof(pmd_t))
  
+ /*
+  * rv64 PTE format:
+  * | 63 | 62 61 | 60 54 | 53  10 | 9             8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
+  *   N      MT     RSV    PFN      reserved for SW   D   A   G   U   X   W   R   V
+  */
+ #define _PAGE_PFN_MASK  GENMASK(53, 10)
+ /*
+  * [62:61] Svpbmt Memory Type definitions:
+  *
+  *  00 - PMA    Normal Cacheable, No change to implied PMA memory type
+  *  01 - NC     Non-cacheable, idempotent, weakly-ordered Main Memory
+  *  10 - IO     Non-cacheable, non-idempotent, strongly-ordered I/O memory
+  *  11 - Rsvd   Reserved for future standard use
+  */
+ #define _PAGE_NOCACHE_SVPBMT  (1UL << 61)
+ #define _PAGE_IO_SVPBMT               (1UL << 62)
+ #define _PAGE_MTMASK_SVPBMT   (_PAGE_NOCACHE_SVPBMT | _PAGE_IO_SVPBMT)
+ /*
+  * [63:59] T-Head Memory Type definitions:
+  *
+  * 00000 - NC   Weakly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable
+  * 01110 - PMA  Weakly-ordered, Cacheable, Bufferable, Shareable, Non-trustable
+  * 10000 - IO   Strongly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable
+  */
+ #define _PAGE_PMA_THEAD               ((1UL << 62) | (1UL << 61) | (1UL << 60))
+ #define _PAGE_NOCACHE_THEAD   0UL
+ #define _PAGE_IO_THEAD                (1UL << 63)
+ #define _PAGE_MTMASK_THEAD    (_PAGE_PMA_THEAD | _PAGE_IO_THEAD | (1UL << 59))
+ static inline u64 riscv_page_mtmask(void)
+ {
+       u64 val;
+       ALT_SVPBMT(val, _PAGE_MTMASK);
+       return val;
+ }
+ static inline u64 riscv_page_nocache(void)
+ {
+       u64 val;
+       ALT_SVPBMT(val, _PAGE_NOCACHE);
+       return val;
+ }
+ static inline u64 riscv_page_io(void)
+ {
+       u64 val;
+       ALT_SVPBMT(val, _PAGE_IO);
+       return val;
+ }
+ #define _PAGE_NOCACHE         riscv_page_nocache()
+ #define _PAGE_IO              riscv_page_io()
+ #define _PAGE_MTMASK          riscv_page_mtmask()
+ /* Set of bits to preserve across pte_modify() */
+ #define _PAGE_CHG_MASK  (~(unsigned long)(_PAGE_PRESENT | _PAGE_READ |        \
+                                         _PAGE_WRITE | _PAGE_EXEC |    \
+                                         _PAGE_USER | _PAGE_GLOBAL |   \
+                                         _PAGE_MTMASK))
  static inline int pud_present(pud_t pud)
  {
        return (pud_val(pud) & _PAGE_PRESENT);
@@@ -86,11 -153,6 +153,11 @@@ static inline int pud_leaf(pud_t pud
        return pud_present(pud) && (pud_val(pud) & _PAGE_LEAF);
  }
  
 +static inline int pud_user(pud_t pud)
 +{
 +      return pud_val(pud) & _PAGE_USER;
 +}
 +
  static inline void set_pud(pud_t *pudp, pud_t pud)
  {
        *pudp = pud;
@@@ -113,12 -175,12 +180,12 @@@ static inline unsigned long _pud_pfn(pu
  
  static inline pmd_t *pud_pgtable(pud_t pud)
  {
-       return (pmd_t *)pfn_to_virt(pud_val(pud) >> _PAGE_PFN_SHIFT);
+       return (pmd_t *)pfn_to_virt(__page_val_to_pfn(pud_val(pud)));
  }
  
  static inline struct page *pud_page(pud_t pud)
  {
-       return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT);
+       return pfn_to_page(__page_val_to_pfn(pud_val(pud)));
  }
  
  #define mm_p4d_folded  mm_p4d_folded
@@@ -143,12 -205,16 +210,16 @@@ static inline bool mm_pud_folded(struc
  
  static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t prot)
  {
-       return __pmd((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
+       unsigned long prot_val = pgprot_val(prot);
+       ALT_THEAD_PMA(prot_val);
+       return __pmd((pfn << _PAGE_PFN_SHIFT) | prot_val);
  }
  
  static inline unsigned long _pmd_pfn(pmd_t pmd)
  {
-       return pmd_val(pmd) >> _PAGE_PFN_SHIFT;
+       return __page_val_to_pfn(pmd_val(pmd));
  }
  
  #define mk_pmd(page, prot)    pfn_pmd(page_to_pfn(page), prot)
index 4200ddede880c00b6443d25d2723f3efd4985b28,eefaab1d353521eb905bf0c71d1982098440d50d..1d1be9d9419c1287a7b4ede8670e488408dae2b1
  #include <asm/tlbflush.h>
  #include <linux/mm_types.h>
  
+ #define __page_val_to_pfn(_val)  (((_val) & _PAGE_PFN_MASK) >> _PAGE_PFN_SHIFT)
  #ifdef CONFIG_64BIT
  #include <asm/pgtable-64.h>
  #else
  #include <asm/pgtable-32.h>
  #endif /* CONFIG_64BIT */
  
 +#include <linux/page_table_check.h>
 +
  #ifdef CONFIG_XIP_KERNEL
  #define XIP_FIXUP(addr) ({                                                    \
        uintptr_t __a = (uintptr_t)(addr);                                      \
@@@ -179,11 -179,8 +181,8 @@@ extern struct pt_alloc_ops pt_ops __ini
  
  #define PAGE_TABLE            __pgprot(_PAGE_TABLE)
  
- /*
-  * The RISC-V ISA doesn't yet specify how to query or modify PMAs, so we can't
-  * change the properties of memory regions.
-  */
- #define _PAGE_IOREMAP _PAGE_KERNEL
+ #define _PAGE_IOREMAP ((_PAGE_KERNEL & ~_PAGE_MTMASK) | _PAGE_IO)
+ #define PAGE_KERNEL_IO                __pgprot(_PAGE_IOREMAP)
  
  extern pgd_t swapper_pg_dir[];
  
@@@ -253,7 -250,11 +252,11 @@@ static inline void pmd_clear(pmd_t *pmd
  
  static inline pgd_t pfn_pgd(unsigned long pfn, pgprot_t prot)
  {
-       return __pgd((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
+       unsigned long prot_val = pgprot_val(prot);
+       ALT_THEAD_PMA(prot_val);
+       return __pgd((pfn << _PAGE_PFN_SHIFT) | prot_val);
  }
  
  static inline unsigned long _pgd_pfn(pgd_t pgd)
  
  static inline struct page *pmd_page(pmd_t pmd)
  {
-       return pfn_to_page(pmd_val(pmd) >> _PAGE_PFN_SHIFT);
+       return pfn_to_page(__page_val_to_pfn(pmd_val(pmd)));
  }
  
  static inline unsigned long pmd_page_vaddr(pmd_t pmd)
  {
-       return (unsigned long)pfn_to_virt(pmd_val(pmd) >> _PAGE_PFN_SHIFT);
+       return (unsigned long)pfn_to_virt(__page_val_to_pfn(pmd_val(pmd)));
  }
  
  static inline pte_t pmd_pte(pmd_t pmd)
@@@ -284,7 -285,7 +287,7 @@@ static inline pte_t pud_pte(pud_t pud
  /* Yields the page frame number (PFN) of a page table entry */
  static inline unsigned long pte_pfn(pte_t pte)
  {
-       return (pte_val(pte) >> _PAGE_PFN_SHIFT);
+       return __page_val_to_pfn(pte_val(pte));
  }
  
  #define pte_page(x)     pfn_to_page(pte_pfn(x))
  /* Constructs a page table entry */
  static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
  {
-       return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
+       unsigned long prot_val = pgprot_val(prot);
+       ALT_THEAD_PMA(prot_val);
+       return __pte((pfn << _PAGE_PFN_SHIFT) | prot_val);
  }
  
  #define mk_pte(page, prot)       pfn_pte(page_to_pfn(page), prot)
@@@ -317,11 -322,6 +324,11 @@@ static inline int pte_exec(pte_t pte
        return pte_val(pte) & _PAGE_EXEC;
  }
  
 +static inline int pte_user(pte_t pte)
 +{
 +      return pte_val(pte) & _PAGE_USER;
 +}
 +
  static inline int pte_huge(pte_t pte)
  {
        return pte_present(pte) && (pte_val(pte) & _PAGE_LEAF);
@@@ -406,7 -406,11 +413,11 @@@ static inline int pmd_protnone(pmd_t pm
  /* Modify page protection bits */
  static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
  {
-       return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
+       unsigned long newprot_val = pgprot_val(newprot);
+       ALT_THEAD_PMA(newprot_val);
+       return __pte((pte_val(pte) & _PAGE_CHG_MASK) | newprot_val);
  }
  
  #define pgd_ERROR(e) \
@@@ -453,7 -457,7 +464,7 @@@ static inline void set_pte(pte_t *ptep
  
  void flush_icache_pte(pte_t pte);
  
 -static inline void set_pte_at(struct mm_struct *mm,
 +static inline void __set_pte_at(struct mm_struct *mm,
        unsigned long addr, pte_t *ptep, pte_t pteval)
  {
        if (pte_present(pteval) && pte_exec(pteval))
        set_pte(ptep, pteval);
  }
  
 +static inline void set_pte_at(struct mm_struct *mm,
 +      unsigned long addr, pte_t *ptep, pte_t pteval)
 +{
 +      page_table_check_pte_set(mm, addr, ptep, pteval);
 +      __set_pte_at(mm, addr, ptep, pteval);
 +}
 +
  static inline void pte_clear(struct mm_struct *mm,
        unsigned long addr, pte_t *ptep)
  {
 -      set_pte_at(mm, addr, ptep, __pte(0));
 +      __set_pte_at(mm, addr, ptep, __pte(0));
  }
  
  #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
@@@ -493,11 -490,7 +504,11 @@@ static inline int ptep_set_access_flags
  static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
                                       unsigned long address, pte_t *ptep)
  {
 -      return __pte(atomic_long_xchg((atomic_long_t *)ptep, 0));
 +      pte_t pte = __pte(atomic_long_xchg((atomic_long_t *)ptep, 0));
 +
 +      page_table_check_pte_clear(mm, address, pte);
 +
 +      return pte;
  }
  
  #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
@@@ -539,6 -532,28 +550,28 @@@ static inline int ptep_clear_flush_youn
        return ptep_test_and_clear_young(vma, address, ptep);
  }
  
+ #define pgprot_noncached pgprot_noncached
+ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
+ {
+       unsigned long prot = pgprot_val(_prot);
+       prot &= ~_PAGE_MTMASK;
+       prot |= _PAGE_IO;
+       return __pgprot(prot);
+ }
+ #define pgprot_writecombine pgprot_writecombine
+ static inline pgprot_t pgprot_writecombine(pgprot_t _prot)
+ {
+       unsigned long prot = pgprot_val(_prot);
+       prot &= ~_PAGE_MTMASK;
+       prot |= _PAGE_NOCACHE;
+       return __pgprot(prot);
+ }
  /*
   * THP functions
   */
@@@ -564,13 -579,6 +597,13 @@@ static inline unsigned long pmd_pfn(pmd
        return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
  }
  
 +#define __pud_to_phys(pud)  (pud_val(pud) >> _PAGE_PFN_SHIFT << PAGE_SHIFT)
 +
 +static inline unsigned long pud_pfn(pud_t pud)
 +{
 +      return ((__pud_to_phys(pud) & PUD_MASK) >> PAGE_SHIFT);
 +}
 +
  static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
  {
        return pte_pmd(pte_modify(pmd_pte(pmd), newprot));
@@@ -592,11 -600,6 +625,11 @@@ static inline int pmd_young(pmd_t pmd
        return pte_young(pmd_pte(pmd));
  }
  
 +static inline int pmd_user(pmd_t pmd)
 +{
 +      return pte_user(pmd_pte(pmd));
 +}
 +
  static inline pmd_t pmd_mkold(pmd_t pmd)
  {
        return pte_pmd(pte_mkold(pmd_pte(pmd)));
@@@ -630,33 -633,14 +663,33 @@@ static inline pmd_t pmd_mkdirty(pmd_t p
  static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
                                pmd_t *pmdp, pmd_t pmd)
  {
 -      return set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd));
 +      page_table_check_pmd_set(mm, addr, pmdp, pmd);
 +      return __set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd));
  }
  
  static inline void set_pud_at(struct mm_struct *mm, unsigned long addr,
                                pud_t *pudp, pud_t pud)
  {
 -      return set_pte_at(mm, addr, (pte_t *)pudp, pud_pte(pud));
 +      page_table_check_pud_set(mm, addr, pudp, pud);
 +      return __set_pte_at(mm, addr, (pte_t *)pudp, pud_pte(pud));
 +}
 +
 +#ifdef CONFIG_PAGE_TABLE_CHECK
 +static inline bool pte_user_accessible_page(pte_t pte)
 +{
 +      return pte_present(pte) && pte_user(pte);
 +}
 +
 +static inline bool pmd_user_accessible_page(pmd_t pmd)
 +{
 +      return pmd_leaf(pmd) && pmd_user(pmd);
 +}
 +
 +static inline bool pud_user_accessible_page(pud_t pud)
 +{
 +      return pud_leaf(pud) && pud_user(pud);
  }
 +#endif
  
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
  static inline int pmd_trans_huge(pmd_t pmd)
@@@ -683,11 -667,7 +716,11 @@@ static inline int pmdp_test_and_clear_y
  static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
                                        unsigned long address, pmd_t *pmdp)
  {
 -      return pte_pmd(ptep_get_and_clear(mm, address, (pte_t *)pmdp));
 +      pmd_t pmd = __pmd(atomic_long_xchg((atomic_long_t *)pmdp, 0));
 +
 +      page_table_check_pmd_clear(mm, address, pmd);
 +
 +      return pmd;
  }
  
  #define __HAVE_ARCH_PMDP_SET_WRPROTECT
@@@ -701,7 -681,6 +734,7 @@@ static inline void pmdp_set_wrprotect(s
  static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
                                unsigned long address, pmd_t *pmdp, pmd_t pmd)
  {
 +      page_table_check_pmd_set(vma->vm_mm, address, pmdp, pmd);
        return __pmd(atomic_long_xchg((atomic_long_t *)pmdp, pmd_val(pmd)));
  }
  #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
   * 63–48 all equal to bit 47, or else a page-fault exception will occur."
   */
  #ifdef CONFIG_64BIT
- #define TASK_SIZE      (PGDIR_SIZE * PTRS_PER_PGD / 2)
- #define TASK_SIZE_MIN  (PGDIR_SIZE_L3 * PTRS_PER_PGD / 2)
+ #define TASK_SIZE_64  (PGDIR_SIZE * PTRS_PER_PGD / 2)
+ #define TASK_SIZE_MIN (PGDIR_SIZE_L3 * PTRS_PER_PGD / 2)
+ #ifdef CONFIG_COMPAT
+ #define TASK_SIZE_32  (_AC(0x80000000, UL) - PAGE_SIZE)
+ #define TASK_SIZE     (test_thread_flag(TIF_32BIT) ? \
+                        TASK_SIZE_32 : TASK_SIZE_64)
+ #else
+ #define TASK_SIZE     TASK_SIZE_64
+ #endif
  #else
  #define TASK_SIZE     FIXADDR_START
  #define TASK_SIZE_MIN TASK_SIZE
diff --combined arch/riscv/mm/init.c
index 180d6a3e2a05f157ce9f0d590d5ac61dc977bacd,fb599885b3cebd2f42e25d8f8b4eedc53ab88086..eed613599ba67a36490c6c4af13f502718ed75cc
@@@ -120,7 -120,13 +120,7 @@@ void __init mem_init(void
        BUG_ON(!mem_map);
  #endif /* CONFIG_FLATMEM */
  
 -#ifdef CONFIG_SWIOTLB
 -      if (swiotlb_force == SWIOTLB_FORCE ||
 -          max_pfn > PFN_DOWN(dma32_phys_limit))
 -              swiotlb_init(1);
 -      else
 -              swiotlb_force = SWIOTLB_NO_FORCE;
 -#endif
 +      swiotlb_init(max_pfn > PFN_DOWN(dma32_phys_limit), SWIOTLB_VERBOSE);
        memblock_free_all();
  
        print_vm_layout();
@@@ -202,25 -208,8 +202,25 @@@ static void __init setup_bootmem(void
         * early_init_fdt_reserve_self() since __pa() does
         * not work for DTB pointers that are fixmap addresses
         */
 -      if (!IS_ENABLED(CONFIG_BUILTIN_DTB))
 -              memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
 +      if (!IS_ENABLED(CONFIG_BUILTIN_DTB)) {
 +              /*
 +               * In case the DTB is not located in a memory region we won't
 +               * be able to locate it later on via the linear mapping and
 +               * get a segfault when accessing it via __va(dtb_early_pa).
 +               * To avoid this situation copy DTB to a memory region.
 +               * Note that memblock_phys_alloc will also reserve DTB region.
 +               */
 +              if (!memblock_is_memory(dtb_early_pa)) {
 +                      size_t fdt_size = fdt_totalsize(dtb_early_va);
 +                      phys_addr_t new_dtb_early_pa = memblock_phys_alloc(fdt_size, PAGE_SIZE);
 +                      void *new_dtb_early_va = early_memremap(new_dtb_early_pa, fdt_size);
 +
 +                      memcpy(new_dtb_early_va, dtb_early_va, fdt_size);
 +                      early_memunmap(new_dtb_early_va, fdt_size);
 +                      _dtb_early_pa = new_dtb_early_pa;
 +              } else
 +                      memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
 +      }
  
        early_init_fdt_scan_reserved_mem();
        dma_contiguous_reserve(dma32_phys_limit);
@@@ -578,9 -567,9 +578,9 @@@ static void __init create_p4d_mapping(p
        create_pte_mapping(__nextp, __va, __pa, __sz, __prot)
  #define fixmap_pgd_next               ((uintptr_t)fixmap_pte)
  #define early_dtb_pgd_next    ((uintptr_t)early_dtb_pmd)
- #define create_p4d_mapping(__pmdp, __va, __pa, __sz, __prot)
- #define create_pud_mapping(__pmdp, __va, __pa, __sz, __prot)
- #define create_pmd_mapping(__pmdp, __va, __pa, __sz, __prot)
+ #define create_p4d_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
+ #define create_pud_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
+ #define create_pmd_mapping(__pmdp, __va, __pa, __sz, __prot) do {} while(0)
  #endif /* __PAGETABLE_PMD_FOLDED */
  
  void __init create_pgd_mapping(pgd_t *pgdp,
@@@ -671,7 -660,7 +671,7 @@@ static __init pgprot_t pgprot_from_va(u
  }
  #endif /* CONFIG_STRICT_KERNEL_RWX */
  
- #ifdef CONFIG_64BIT
+ #if defined(CONFIG_64BIT) && !defined(CONFIG_XIP_KERNEL)
  static void __init disable_pgtable_l5(void)
  {
        pgtable_l5_enabled = false;
@@@ -729,7 -718,6 +729,7 @@@ retry
                if (!check_l4) {
                        disable_pgtable_l5();
                        check_l4 = true;
 +                      memset(early_pg_dir, 0, PAGE_SIZE);
                        goto retry;
                }
                disable_pgtable_l4();
@@@ -947,6 -935,7 +947,7 @@@ asmlinkage void __init setup_vm(uintptr
        BUG_ON((kernel_map.virt_addr + kernel_map.size) > ADDRESS_SPACE_END - SZ_4K);
  #endif
  
+       apply_early_boot_alternatives();
        pt_ops_set_early();
  
        /* Setup early PGD for fixmap */
diff --combined arch/s390/Kconfig
index 5886e039e16d3b0a18844f2be585f7c47c8cca11,555b7ea5ecf5b997289fd80fcc4c8f2702592c0f..b17239ae7bd4ad780e08c8cb671bd3f708a1a304
@@@ -255,10 -255,6 +255,10 @@@ config HAVE_MARCH_Z15_FEATURE
        def_bool n
        select HAVE_MARCH_Z14_FEATURES
  
 +config HAVE_MARCH_Z16_FEATURES
 +      def_bool n
 +      select HAVE_MARCH_Z15_FEATURES
 +
  choice
        prompt "Processor type"
        default MARCH_Z196
@@@ -316,14 -312,6 +316,14 @@@ config MARCH_Z1
          and 8561 series). The kernel will be slightly faster but will not
          work on older machines.
  
 +config MARCH_Z16
 +      bool "IBM z16"
 +      select HAVE_MARCH_Z16_FEATURES
 +      depends on $(cc-option,-march=z16)
 +      help
 +        Select this to enable optimizations for IBM z16 (3931 and
 +        3932 series).
 +
  endchoice
  
  config MARCH_Z10_TUNE
@@@ -344,9 -332,6 +344,9 @@@ config MARCH_Z14_TUN
  config MARCH_Z15_TUNE
        def_bool TUNE_Z15 || MARCH_Z15 && TUNE_DEFAULT
  
 +config MARCH_Z16_TUNE
 +      def_bool TUNE_Z16 || MARCH_Z16 && TUNE_DEFAULT
 +
  choice
        prompt "Tune code generation"
        default TUNE_DEFAULT
@@@ -387,10 -372,6 +387,10 @@@ config TUNE_Z1
        bool "IBM z15"
        depends on $(cc-option,-mtune=z15)
  
 +config TUNE_Z16
 +      bool "IBM z16"
 +      depends on $(cc-option,-mtune=z16)
 +
  endchoice
  
  config 64BIT
@@@ -418,9 -399,6 +418,6 @@@ config COMPA
          (and some other stuff like libraries and such) is needed for
          executing 31 bit applications.  It is safe to say "Y".
  
- config SYSVIPC_COMPAT
-       def_bool y if COMPAT && SYSVIPC
  config SMP
        def_bool y
  
@@@ -586,6 -564,7 +583,6 @@@ endchoic
  
  config RELOCATABLE
        bool "Build a relocatable kernel"
 -      select MODULE_REL_CRCS if MODVERSIONS
        default y
        help
          This builds a kernel image that retains relocation information
index 7d6fe813ac39ee03110e4706bc60b5f9ca9b8839,ad809cf3dd97c9650d0deea5c42e75af32c87352..a386070f1d5653a97bf2aa075b21c23e83eac436
@@@ -8,11 -8,22 +8,23 @@@
  #include <linux/sched.h>
  #include <linux/sched/task_stack.h>
  #include <linux/thread_info.h>
 +#include <asm/ptrace.h>
  
  #define compat_mode_t compat_mode_t
  typedef u16           compat_mode_t;
  
+ #define __compat_uid_t        __compat_uid_t
+ typedef u16           __compat_uid_t;
+ typedef u16           __compat_gid_t;
+ #define compat_dev_t  compat_dev_t
+ typedef u16           compat_dev_t;
+ #define compat_ipc_pid_t compat_ipc_pid_t
+ typedef u16            compat_ipc_pid_t;
+ #define compat_statfs compat_statfs
  #include <asm-generic/compat.h>
  
  #define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p( \
        (__force t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \
  })
  
 -#define PSW32_MASK_PER                0x40000000UL
 -#define PSW32_MASK_DAT                0x04000000UL
 -#define PSW32_MASK_IO         0x02000000UL
 -#define PSW32_MASK_EXT                0x01000000UL
 -#define PSW32_MASK_KEY                0x00F00000UL
 -#define PSW32_MASK_BASE               0x00080000UL    /* Always one */
 -#define PSW32_MASK_MCHECK     0x00040000UL
 -#define PSW32_MASK_WAIT               0x00020000UL
 -#define PSW32_MASK_PSTATE     0x00010000UL
 -#define PSW32_MASK_ASC                0x0000C000UL
 -#define PSW32_MASK_CC         0x00003000UL
 -#define PSW32_MASK_PM         0x00000f00UL
 -#define PSW32_MASK_RI         0x00000080UL
 -
  #define PSW32_MASK_USER               0x0000FF00UL
  
 -#define PSW32_ADDR_AMODE      0x80000000UL
 -#define PSW32_ADDR_INSN               0x7FFFFFFFUL
 -
 -#define PSW32_DEFAULT_KEY     (((u32) PAGE_DEFAULT_ACC) << 20)
 -
 -#define PSW32_ASC_PRIMARY     0x00000000UL
 -#define PSW32_ASC_ACCREG      0x00004000UL
 -#define PSW32_ASC_SECONDARY   0x00008000UL
 -#define PSW32_ASC_HOME                0x0000C000UL
 -
  #define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \
                         PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \
                         PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \
                         PSW32_ASC_PRIMARY)
  
- #define COMPAT_USER_HZ                100
  #define COMPAT_UTS_MACHINE    "s390\0\0\0\0"
  
- typedef u16           __compat_uid_t;
- typedef u16           __compat_gid_t;
- typedef u16           compat_dev_t;
  typedef u16           compat_nlink_t;
- typedef u16           compat_ipc_pid_t;
- typedef __kernel_fsid_t       compat_fsid_t;
  
  typedef struct {
        u32 mask;
@@@ -79,26 -108,6 +85,6 @@@ struct compat_stat 
        u32             __unused5;
  };
  
- struct compat_flock {
-       short           l_type;
-       short           l_whence;
-       compat_off_t    l_start;
-       compat_off_t    l_len;
-       compat_pid_t    l_pid;
- };
- #define F_GETLK64       12
- #define F_SETLK64       13
- #define F_SETLKW64      14    
- struct compat_flock64 {
-       short           l_type;
-       short           l_whence;
-       compat_loff_t   l_start;
-       compat_loff_t   l_len;
-       compat_pid_t    l_pid;
- };
  struct compat_statfs {
        u32             f_type;
        u32             f_bsize;
@@@ -129,10 -138,6 +115,6 @@@ struct compat_statfs64 
        u32             f_spare[4];
  };
  
- #define COMPAT_RLIM_INFINITY          0xffffffff
- #define COMPAT_OFF_T_MAX      0x7fffffff
  /*
   * A pointer passed in from user mode. This should not
   * be used for syscall parameters, just declare them
@@@ -155,61 -160,4 +137,4 @@@ static inline int is_compat_task(void
  
  #endif
  
- struct compat_ipc64_perm {
-       compat_key_t key;
-       __compat_uid32_t uid;
-       __compat_gid32_t gid;
-       __compat_uid32_t cuid;
-       __compat_gid32_t cgid;
-       compat_mode_t mode;
-       unsigned short __pad1;
-       unsigned short seq;
-       unsigned short __pad2;
-       unsigned int __unused1;
-       unsigned int __unused2;
- };
- struct compat_semid64_ds {
-       struct compat_ipc64_perm sem_perm;
-       compat_ulong_t sem_otime;
-       compat_ulong_t sem_otime_high;
-       compat_ulong_t sem_ctime;
-       compat_ulong_t sem_ctime_high;
-       compat_ulong_t sem_nsems;
-       compat_ulong_t __unused1;
-       compat_ulong_t __unused2;
- };
- struct compat_msqid64_ds {
-       struct compat_ipc64_perm msg_perm;
-       compat_ulong_t msg_stime;
-       compat_ulong_t msg_stime_high;
-       compat_ulong_t msg_rtime;
-       compat_ulong_t msg_rtime_high;
-       compat_ulong_t msg_ctime;
-       compat_ulong_t msg_ctime_high;
-       compat_ulong_t msg_cbytes;
-       compat_ulong_t msg_qnum;
-       compat_ulong_t msg_qbytes;
-       compat_pid_t   msg_lspid;
-       compat_pid_t   msg_lrpid;
-       compat_ulong_t __unused1;
-       compat_ulong_t __unused2;
- };
- struct compat_shmid64_ds {
-       struct compat_ipc64_perm shm_perm;
-       compat_size_t  shm_segsz;
-       compat_ulong_t shm_atime;
-       compat_ulong_t shm_atime_high;
-       compat_ulong_t shm_dtime;
-       compat_ulong_t shm_dtime_high;
-       compat_ulong_t shm_ctime;
-       compat_ulong_t shm_ctime_high;
-       compat_pid_t   shm_cpid;
-       compat_pid_t   shm_lpid;
-       compat_ulong_t shm_nattch;
-       compat_ulong_t __unused1;
-       compat_ulong_t __unused2;
- };
  #endif /* _ASM_S390X_COMPAT_H */
diff --combined arch/sparc/Kconfig
index 85b573643af61f5baa3f239bbae63719030d246d,9c1cce74953a9429b50218daffeae7e529f41c26..ba449c47effd8d975abf2f1130acef46e46662f9
@@@ -84,7 -84,6 +84,7 @@@ config SPARC6
        select PERF_USE_VMALLOC
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select HAVE_C_RECORDMCOUNT
 +      select ARCH_HAS_VM_GET_PAGE_PROT
        select HAVE_ARCH_AUDITSYSCALL
        select ARCH_SUPPORTS_ATOMIC_RMW
        select ARCH_SUPPORTS_DEBUG_PAGEALLOC
@@@ -489,9 -488,4 +489,4 @@@ config COMPA
        select ARCH_WANT_OLD_COMPAT_IPC
        select COMPAT_OLD_SIGACTION
  
- config SYSVIPC_COMPAT
-       bool
-       depends on COMPAT && SYSVIPC
-       default y
  source "drivers/sbus/char/Kconfig"
diff --combined arch/x86/Kconfig
index cf531fbcd2295ec2a77007274ad529180c84cd0b,65690b950f5f4d4f2cfe1caec05c18cb3bec8bff..a293a30e4cdde9d3a399bd70141f04c6276a7290
@@@ -76,6 -76,7 +76,6 @@@ config X8
        select ARCH_HAS_EARLY_DEBUG             if KGDB
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_FAST_MULTIPLIER
 -      select ARCH_HAS_FILTER_PGPROT
        select ARCH_HAS_FORTIFY_SOURCE
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_KCOV                    if X86_64
@@@ -94,7 -95,6 +94,7 @@@
        select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
        select ARCH_HAS_SYSCALL_WRAPPER
        select ARCH_HAS_UBSAN_SANITIZE_ALL
 +      select ARCH_HAS_VM_GET_PAGE_PROT
        select ARCH_HAS_DEBUG_WX
        select ARCH_HAS_ZONE_DMA_SET if EXPERT
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_WANTS_NO_INSTR
        select ARCH_WANT_GENERAL_HUGETLB
        select ARCH_WANT_HUGE_PMD_SHARE
 +      select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP  if X86_64
        select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_WANTS_THP_SWAP              if X86_64
        select ARCH_HAS_PARANOID_L1D_FLUSH
        select HAVE_CONTEXT_TRACKING            if X86_64
        select HAVE_CONTEXT_TRACKING_OFFSTACK   if HAVE_CONTEXT_TRACKING
        select HAVE_C_RECORDMCOUNT
 -      select HAVE_OBJTOOL_MCOUNT              if STACK_VALIDATION
 +      select HAVE_OBJTOOL_MCOUNT              if HAVE_OBJTOOL
        select HAVE_BUILDTIME_MCOUNT_SORT
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_CONTIGUOUS
        select HAVE_IOREMAP_PROT
        select HAVE_IRQ_EXIT_ON_IRQ_STACK       if X86_64
        select HAVE_IRQ_TIME_ACCOUNTING
 +      select HAVE_JUMP_LABEL_HACK             if HAVE_OBJTOOL
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_LZ4
        select HAVE_MOD_ARCH_SPECIFIC
        select HAVE_MOVE_PMD
        select HAVE_MOVE_PUD
 +      select HAVE_NOINSTR_HACK                if HAVE_OBJTOOL
        select HAVE_NMI
 +      select HAVE_NOINSTR_VALIDATION          if HAVE_OBJTOOL
 +      select HAVE_OBJTOOL                     if X86_64
        select HAVE_OPTPROBES
        select HAVE_PCSPKR_PLATFORM
        select HAVE_PERF_EVENTS
        select HAVE_PCI
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
 -      select MMU_GATHER_RCU_TABLE_FREE                if PARAVIRT
 +      select MMU_GATHER_RCU_TABLE_FREE        if PARAVIRT
        select HAVE_POSIX_CPU_TIMERS_TASK_WORK
        select HAVE_REGS_AND_STACK_ACCESS_API
 -      select HAVE_RELIABLE_STACKTRACE         if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION
 +      select HAVE_RELIABLE_STACKTRACE         if UNWINDER_ORC || STACK_VALIDATION
        select HAVE_FUNCTION_ARG_ACCESS_API
        select HAVE_SETUP_PER_CPU_AREA
        select HAVE_SOFTIRQ_ON_OWN_STACK
        select HAVE_STACKPROTECTOR              if CC_HAS_SANE_STACKPROTECTOR
 -      select HAVE_STACK_VALIDATION            if X86_64
 +      select HAVE_STACK_VALIDATION            if HAVE_OBJTOOL
        select HAVE_STATIC_CALL
 -      select HAVE_STATIC_CALL_INLINE          if HAVE_STACK_VALIDATION
 +      select HAVE_STATIC_CALL_INLINE          if HAVE_OBJTOOL
        select HAVE_PREEMPT_DYNAMIC_CALL
        select HAVE_RSEQ
        select HAVE_SYSCALL_TRACEPOINTS
        select RTC_MC146818_LIB
        select SPARSE_IRQ
        select SRCU
 -      select STACK_VALIDATION                 if HAVE_STACK_VALIDATION && (HAVE_STATIC_CALL_INLINE || RETPOLINE)
        select SYSCTL_EXCEPTION_TRACE
        select THREAD_INFO_IN_TASK
        select TRACE_IRQFLAGS_SUPPORT
@@@ -463,7 -459,6 +463,7 @@@ config GOLDFIS
  
  config RETPOLINE
        bool "Avoid speculative indirect branches in kernel"
 +      select OBJTOOL if HAVE_OBJTOOL
        default y
        help
          Compile kernel with the retpoline compiler options to guard against
@@@ -477,7 -472,6 +477,7 @@@ config CC_HAS_SL
  config SLS
        bool "Mitigate Straight-Line-Speculation"
        depends on CC_HAS_SLS && X86_64
 +      select OBJTOOL if HAVE_OBJTOOL
        default n
        help
          Compile the kernel with straight-line-speculation options to guard
@@@ -884,21 -878,6 +884,21 @@@ config ACRN_GUES
          IOT with small footprint and real-time features. More details can be
          found in https://projectacrn.org/.
  
 +config INTEL_TDX_GUEST
 +      bool "Intel TDX (Trust Domain Extensions) - Guest Support"
 +      depends on X86_64 && CPU_SUP_INTEL
 +      depends on X86_X2APIC
 +      select ARCH_HAS_CC_PLATFORM
 +      select X86_MEM_ENCRYPT
 +      select X86_MCE
 +      help
 +        Support running as a guest under Intel TDX.  Without this support,
 +        the guest kernel can not boot or run under TDX.
 +        TDX includes memory encryption and integrity capabilities
 +        which protect the confidentiality and integrity of guest
 +        memory contents and CPU state. TDX guests are protected from
 +        some attacks from the VMM.
 +
  endif #HYPERVISOR_GUEST
  
  source "arch/x86/Kconfig.cpu"
@@@ -961,12 -940,6 +961,12 @@@ config GART_IOMM
  
          If unsure, say Y.
  
 +config BOOT_VESA_SUPPORT
 +      bool
 +      help
 +        If true, at least one selected framebuffer driver can take advantage
 +        of VESA video modes set at an early boot stage via the vga= parameter.
 +
  config MAXSMP
        bool "Enable Maximum number of SMP Processors and NUMA Nodes"
        depends on X86_64 && SMP && DEBUG_KERNEL
@@@ -1340,7 -1313,7 +1340,7 @@@ config MICROCOD
  
  config MICROCODE_INTEL
        bool "Intel microcode loading support"
 -      depends on MICROCODE
 +      depends on CPU_SUP_INTEL && MICROCODE
        default MICROCODE
        help
          This options enables microcode patch loading support for Intel
  
  config MICROCODE_AMD
        bool "AMD microcode loading support"
 -      depends on MICROCODE
 +      depends on CPU_SUP_AMD && MICROCODE
        help
          If you select this option, microcode patch loading support for AMD
          processors will be enabled.
@@@ -1843,6 -1816,17 +1843,6 @@@ config ARCH_RANDO
          If supported, this is a high bandwidth, cryptographically
          secure hardware random number generator.
  
 -config X86_SMAP
 -      def_bool y
 -      prompt "Supervisor Mode Access Prevention" if EXPERT
 -      help
 -        Supervisor Mode Access Prevention (SMAP) is a security
 -        feature in newer Intel processors.  There is a small
 -        performance cost if this enabled and turned on; there is
 -        also a small increase in the kernel size if this is enabled.
 -
 -        If unsure, say Y.
 -
  config X86_UMIP
        def_bool y
        prompt "User Mode Instruction Prevention" if EXPERT
@@@ -1871,10 -1855,9 +1871,10 @@@ config CC_HAS_IB
  config X86_KERNEL_IBT
        prompt "Indirect Branch Tracking"
        bool
 -      depends on X86_64 && CC_HAS_IBT && STACK_VALIDATION
 +      depends on X86_64 && CC_HAS_IBT && HAVE_OBJTOOL
        # https://github.com/llvm/llvm-project/commit/9d7001eba9c4cb311e03cd8cdc231f9e579f2d0f
        depends on !LD_IS_LLD || LLD_VERSION >= 140000
 +      select OBJTOOL
        help
          Build the kernel with support for Indirect Branch Tracking, a
          hardware support course-grain forward-edge Control Flow Integrity
          code with them to make this happen.
  
          In addition to building the kernel with IBT, seal all functions that
 -        are not indirect call targets, avoiding them ever becomming one.
 +        are not indirect call targets, avoiding them ever becoming one.
  
          This requires LTO like objtool runs and will slow down the build. It
          does significantly reduce the number of ENDBR instructions in the
@@@ -2343,9 -2326,7 +2343,9 @@@ choic
          it can be used to assist security vulnerability exploitation.
  
          This setting can be changed at boot time via the kernel command
 -        line parameter vsyscall=[emulate|xonly|none].
 +        line parameter vsyscall=[emulate|xonly|none].  Emulate mode
 +        is deprecated and can only be enabled using the kernel command
 +        line.
  
          On a system with recent enough glibc (2.14 or newer) and no
          static binaries, you can say None without a performance penalty
  
          If unsure, select "Emulate execution only".
  
 -      config LEGACY_VSYSCALL_EMULATE
 -              bool "Full emulation"
 -              help
 -                The kernel traps and emulates calls into the fixed vsyscall
 -                address mapping. This makes the mapping non-executable, but
 -                it still contains readable known contents, which could be
 -                used in certain rare security vulnerability exploits. This
 -                configuration is recommended when using legacy userspace
 -                that still uses vsyscalls along with legacy binary
 -                instrumentation tools that require code to be readable.
 -
 -                An example of this type of legacy userspace is running
 -                Pin on an old binary that still uses vsyscalls.
 -
        config LEGACY_VSYSCALL_XONLY
                bool "Emulate execution only"
                help
@@@ -2843,6 -2838,13 +2843,6 @@@ config IA32_EMULATIO
          64-bit kernel. You should likely turn this on, unless you're
          100% sure that you don't have any 32-bit programs left.
  
 -config IA32_AOUT
 -      tristate "IA32 a.out support"
 -      depends on IA32_EMULATION
 -      depends on BROKEN
 -      help
 -        Support old a.out binaries in the 32bit emulation.
 -
  config X86_X32_ABI
        bool "x32 ABI for 64-bit mode"
        depends on X86_64
@@@ -2870,10 -2872,6 +2870,6 @@@ config COMPA
  if COMPAT
  config COMPAT_FOR_U64_ALIGNMENT
        def_bool y
- config SYSVIPC_COMPAT
-       def_bool y
-       depends on SYSVIPC
  endif
  
  endmenu
index 20fd0acd7d800b58a8b95b2ff807899af94cfae1,e74a107de0d077600be8ae60c2ae8811bb26ed16..b1221da477b7438bf7a562fbbec3069b254addc0
  #define compat_mode_t compat_mode_t
  typedef u16           compat_mode_t;
  
+ #define __compat_uid_t        __compat_uid_t
+ typedef u16           __compat_uid_t;
+ typedef u16           __compat_gid_t;
+ #define compat_dev_t  compat_dev_t
+ typedef u16           compat_dev_t;
+ #define compat_ipc_pid_t compat_ipc_pid_t
+ typedef u16            compat_ipc_pid_t;
+ #define compat_statfs compat_statfs
  #include <asm-generic/compat.h>
  
- #define COMPAT_USER_HZ                100
  #define COMPAT_UTS_MACHINE    "i686\0\0"
  
- typedef u16           __compat_uid_t;
- typedef u16           __compat_gid_t;
- typedef u16           compat_dev_t;
  typedef u16           compat_nlink_t;
- typedef u16           compat_ipc_pid_t;
- typedef __kernel_fsid_t       compat_fsid_t;
  
  struct compat_stat {
 -      compat_dev_t    st_dev;
 -      u16             __pad1;
 +      u32             st_dev;
        compat_ino_t    st_ino;
        compat_mode_t   st_mode;
        compat_nlink_t  st_nlink;
        __compat_uid_t  st_uid;
        __compat_gid_t  st_gid;
 -      compat_dev_t    st_rdev;
 -      u16             __pad2;
 +      u32             st_rdev;
        u32             st_size;
        u32             st_blksize;
        u32             st_blocks;
        u32             __unused5;
  };
  
- struct compat_flock {
-       short           l_type;
-       short           l_whence;
-       compat_off_t    l_start;
-       compat_off_t    l_len;
-       compat_pid_t    l_pid;
- };
- #define F_GETLK64     12      /*  using 'struct flock64' */
- #define F_SETLK64     13
- #define F_SETLKW64    14
  /*
-  * IA32 uses 4 byte alignment for 64 bit quantities,
-  * so we need to pack this structure.
+  * IA32 uses 4 byte alignment for 64 bit quantities, so we need to pack the
+  * compat flock64 structure.
   */
- struct compat_flock64 {
-       short           l_type;
-       short           l_whence;
-       compat_loff_t   l_start;
-       compat_loff_t   l_len;
-       compat_pid_t    l_pid;
- } __attribute__((packed));
+ #define __ARCH_NEED_COMPAT_FLOCK64_PACKED
  
  struct compat_statfs {
        int             f_type;
        int             f_spare[4];
  };
  
- #define COMPAT_RLIM_INFINITY          0xffffffff
- #define COMPAT_OFF_T_MAX      0x7fffffff
- struct compat_ipc64_perm {
-       compat_key_t key;
-       __compat_uid32_t uid;
-       __compat_gid32_t gid;
-       __compat_uid32_t cuid;
-       __compat_gid32_t cgid;
-       unsigned short mode;
-       unsigned short __pad1;
-       unsigned short seq;
-       unsigned short __pad2;
-       compat_ulong_t unused1;
-       compat_ulong_t unused2;
- };
- struct compat_semid64_ds {
-       struct compat_ipc64_perm sem_perm;
-       compat_ulong_t sem_otime;
-       compat_ulong_t sem_otime_high;
-       compat_ulong_t sem_ctime;
-       compat_ulong_t sem_ctime_high;
-       compat_ulong_t sem_nsems;
-       compat_ulong_t __unused3;
-       compat_ulong_t __unused4;
- };
- struct compat_msqid64_ds {
-       struct compat_ipc64_perm msg_perm;
-       compat_ulong_t msg_stime;
-       compat_ulong_t msg_stime_high;
-       compat_ulong_t msg_rtime;
-       compat_ulong_t msg_rtime_high;
-       compat_ulong_t msg_ctime;
-       compat_ulong_t msg_ctime_high;
-       compat_ulong_t msg_cbytes;
-       compat_ulong_t msg_qnum;
-       compat_ulong_t msg_qbytes;
-       compat_pid_t   msg_lspid;
-       compat_pid_t   msg_lrpid;
-       compat_ulong_t __unused4;
-       compat_ulong_t __unused5;
- };
- struct compat_shmid64_ds {
-       struct compat_ipc64_perm shm_perm;
-       compat_size_t  shm_segsz;
-       compat_ulong_t shm_atime;
-       compat_ulong_t shm_atime_high;
-       compat_ulong_t shm_dtime;
-       compat_ulong_t shm_dtime_high;
-       compat_ulong_t shm_ctime;
-       compat_ulong_t shm_ctime_high;
-       compat_pid_t   shm_cpid;
-       compat_pid_t   shm_lpid;
-       compat_ulong_t shm_nattch;
-       compat_ulong_t __unused4;
-       compat_ulong_t __unused5;
- };
  #ifdef CONFIG_X86_X32_ABI
  #define COMPAT_USE_64BIT_TIME \
        (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
diff --combined fs/open.c
index be849dcca032f19bd8f95e3616c7ae5e9e7054f8,0573eebb68a691436289ea705c7696b06e1de11e..1d57fbde2feb1c27e7bd059731abb31477eb6ba4
+++ b/fs/open.c
@@@ -224,6 -224,21 +224,21 @@@ SYSCALL_DEFINE2(ftruncate64, unsigned i
  }
  #endif /* BITS_PER_LONG == 32 */
  
+ #if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_TRUNCATE64)
+ COMPAT_SYSCALL_DEFINE3(truncate64, const char __user *, pathname,
+                      compat_arg_u64_dual(length))
+ {
+       return ksys_truncate(pathname, compat_arg_u64_glue(length));
+ }
+ #endif
+ #if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_FTRUNCATE64)
+ COMPAT_SYSCALL_DEFINE3(ftruncate64, unsigned int, fd,
+                      compat_arg_u64_dual(length))
+ {
+       return ksys_ftruncate(fd, compat_arg_u64_glue(length));
+ }
+ #endif
  
  int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
  {
@@@ -339,6 -354,15 +354,15 @@@ SYSCALL_DEFINE4(fallocate, int, fd, int
        return ksys_fallocate(fd, mode, offset, len);
  }
  
+ #if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_FALLOCATE)
+ COMPAT_SYSCALL_DEFINE6(fallocate, int, fd, int, mode, compat_arg_u64_dual(offset),
+                      compat_arg_u64_dual(len))
+ {
+       return ksys_fallocate(fd, mode, compat_arg_u64_glue(offset),
+                             compat_arg_u64_glue(len));
+ }
+ #endif
  /*
   * access() needs to use the real uid/gid, not the effective uid/gid.
   * We do this by temporarily clearing all FS-related capabilities and
@@@ -834,15 -858,16 +858,15 @@@ static int do_dentry_open(struct file *
        if ((f->f_mode & FMODE_WRITE) &&
             likely(f->f_op->write || f->f_op->write_iter))
                f->f_mode |= FMODE_CAN_WRITE;
 +      if (f->f_mapping->a_ops && f->f_mapping->a_ops->direct_IO)
 +              f->f_mode |= FMODE_CAN_ODIRECT;
  
        f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
  
        file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
  
 -      /* NB: we're sure to have correct a_ops only after f_op->open */
 -      if (f->f_flags & O_DIRECT) {
 -              if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO)
 -                      return -EINVAL;
 -      }
 +      if ((f->f_flags & O_DIRECT) && !(f->f_mode & FMODE_CAN_ODIRECT))
 +              return -EINVAL;
  
        /*
         * XXX: Huge page cache doesn't support writing yet. Drop all page
@@@ -980,48 -1005,6 +1004,48 @@@ struct file *dentry_open(const struct p
  }
  EXPORT_SYMBOL(dentry_open);
  
 +/**
 + * dentry_create - Create and open a file
 + * @path: path to create
 + * @flags: O_ flags
 + * @mode: mode bits for new file
 + * @cred: credentials to use
 + *
 + * Caller must hold the parent directory's lock, and have prepared
 + * a negative dentry, placed in @path->dentry, for the new file.
 + *
 + * Caller sets @path->mnt to the vfsmount of the filesystem where
 + * the new file is to be created. The parent directory and the
 + * negative dentry must reside on the same filesystem instance.
 + *
 + * On success, returns a "struct file *". Otherwise a ERR_PTR
 + * is returned.
 + */
 +struct file *dentry_create(const struct path *path, int flags, umode_t mode,
 +                         const struct cred *cred)
 +{
 +      struct file *f;
 +      int error;
 +
 +      validate_creds(cred);
 +      f = alloc_empty_file(flags, cred);
 +      if (IS_ERR(f))
 +              return f;
 +
 +      error = vfs_create(mnt_user_ns(path->mnt),
 +                         d_inode(path->dentry->d_parent),
 +                         path->dentry, mode, true);
 +      if (!error)
 +              error = vfs_open(path, f);
 +
 +      if (unlikely(error)) {
 +              fput(f);
 +              return ERR_PTR(error);
 +      }
 +      return f;
 +}
 +EXPORT_SYMBOL(dentry_create);
 +
  struct file *open_with_fake_path(const struct path *path, int flags,
                                struct inode *inode, const struct cred *cred)
  {
diff --combined fs/stat.c
index 5c2c94464e8b0242430dc050f96678c35511509d,5d8f723c1e0b73d5d565de4fd9e30c85dad25df1..9ced8860e0f35d305fabe984254d9f746808117a
+++ b/fs/stat.c
@@@ -348,6 -348,9 +348,6 @@@ SYSCALL_DEFINE2(fstat, unsigned int, fd
  #  define choose_32_64(a,b) b
  #endif
  
 -#define valid_dev(x)  choose_32_64(old_valid_dev(x),true)
 -#define encode_dev(x) choose_32_64(old_encode_dev,new_encode_dev)(x)
 -
  #ifndef INIT_STRUCT_STAT_PADDING
  #  define INIT_STRUCT_STAT_PADDING(st) memset(&st, 0, sizeof(st))
  #endif
@@@ -356,9 -359,7 +356,9 @@@ static int cp_new_stat(struct kstat *st
  {
        struct stat tmp;
  
 -      if (!valid_dev(stat->dev) || !valid_dev(stat->rdev))
 +      if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev))
 +              return -EOVERFLOW;
 +      if (sizeof(tmp.st_rdev) < 4 && !old_valid_dev(stat->rdev))
                return -EOVERFLOW;
  #if BITS_PER_LONG == 32
        if (stat->size > MAX_NON_LFS)
  #endif
  
        INIT_STRUCT_STAT_PADDING(tmp);
 -      tmp.st_dev = encode_dev(stat->dev);
 +      tmp.st_dev = new_encode_dev(stat->dev);
        tmp.st_ino = stat->ino;
        if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino)
                return -EOVERFLOW;
                return -EOVERFLOW;
        SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid));
        SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid));
 -      tmp.st_rdev = encode_dev(stat->rdev);
 +      tmp.st_rdev = new_encode_dev(stat->rdev);
        tmp.st_size = stat->size;
        tmp.st_atime = stat->atime.tv_sec;
        tmp.st_mtime = stat->mtime.tv_sec;
@@@ -659,18 -660,16 +659,18 @@@ SYSCALL_DEFINE5(statx
        return ret;
  }
  
- #ifdef CONFIG_COMPAT
+ #if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_STAT)
  static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
  {
        struct compat_stat tmp;
  
 -      if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev))
 +      if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev))
 +              return -EOVERFLOW;
 +      if (sizeof(tmp.st_rdev) < 4 && !old_valid_dev(stat->rdev))
                return -EOVERFLOW;
  
        memset(&tmp, 0, sizeof(tmp));
 -      tmp.st_dev = old_encode_dev(stat->dev);
 +      tmp.st_dev = new_encode_dev(stat->dev);
        tmp.st_ino = stat->ino;
        if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino)
                return -EOVERFLOW;
                return -EOVERFLOW;
        SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid));
        SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid));
 -      tmp.st_rdev = old_encode_dev(stat->rdev);
 +      tmp.st_rdev = new_encode_dev(stat->rdev);
        if ((u64) stat->size > MAX_NON_LFS)
                return -EOVERFLOW;
        tmp.st_size = stat->size;
diff --combined include/linux/compat.h
index 01fddf72a81f081d4392b56aa3734123f8fa7a29,ce6cd9b30d27aed7833cde9e7a0cb18cba2557f8..594357881b0b3b5a0e06d9c07a6626fc4a517a2a
@@@ -235,7 -235,6 +235,7 @@@ typedef struct compat_siginfo 
                                struct {
                                        compat_ulong_t _data;
                                        u32 _type;
 +                                      u32 _flags;
                                } _perf;
                        };
                } _sigfault;
@@@ -259,6 -258,37 +259,37 @@@ struct compat_rlimit 
        compat_ulong_t  rlim_max;
  };
  
+ #ifdef __ARCH_NEED_COMPAT_FLOCK64_PACKED
+ #define __ARCH_COMPAT_FLOCK64_PACK    __attribute__((packed))
+ #else
+ #define __ARCH_COMPAT_FLOCK64_PACK
+ #endif
+ struct compat_flock {
+       short                   l_type;
+       short                   l_whence;
+       compat_off_t            l_start;
+       compat_off_t            l_len;
+ #ifdef __ARCH_COMPAT_FLOCK_EXTRA_SYSID
+       __ARCH_COMPAT_FLOCK_EXTRA_SYSID
+ #endif
+       compat_pid_t            l_pid;
+ #ifdef __ARCH_COMPAT_FLOCK_PAD
+       __ARCH_COMPAT_FLOCK_PAD
+ #endif
+ };
+ struct compat_flock64 {
+       short           l_type;
+       short           l_whence;
+       compat_loff_t   l_start;
+       compat_loff_t   l_len;
+       compat_pid_t    l_pid;
+ #ifdef __ARCH_COMPAT_FLOCK64_PAD
+       __ARCH_COMPAT_FLOCK64_PAD
+ #endif
+ } __ARCH_COMPAT_FLOCK64_PACK;
  struct compat_rusage {
        struct old_timeval32 ru_utime;
        struct old_timeval32 ru_stime;
@@@ -896,6 -926,43 +927,43 @@@ asmlinkage long compat_sys_sigaction(in
  /* obsolete: net/socket.c */
  asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
  
+ #ifdef __ARCH_WANT_COMPAT_TRUNCATE64
+ asmlinkage long compat_sys_truncate64(const char __user *pathname, compat_arg_u64(len));
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_FTRUNCATE64
+ asmlinkage long compat_sys_ftruncate64(unsigned int fd, compat_arg_u64(len));
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_FALLOCATE
+ asmlinkage long compat_sys_fallocate(int fd, int mode, compat_arg_u64(offset),
+                                    compat_arg_u64(len));
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_PREAD64
+ asmlinkage long compat_sys_pread64(unsigned int fd, char __user *buf, size_t count,
+                                  compat_arg_u64(pos));
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_PWRITE64
+ asmlinkage long compat_sys_pwrite64(unsigned int fd, const char __user *buf, size_t count,
+                                   compat_arg_u64(pos));
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_SYNC_FILE_RANGE
+ asmlinkage long compat_sys_sync_file_range(int fd, compat_arg_u64(pos),
+                                          compat_arg_u64(nbytes), unsigned int flags);
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_FADVISE64_64
+ asmlinkage long compat_sys_fadvise64_64(int fd, compat_arg_u64(pos),
+                                       compat_arg_u64(len), int advice);
+ #endif
+ #ifdef __ARCH_WANT_COMPAT_READAHEAD
+ asmlinkage long compat_sys_readahead(int fd, compat_arg_u64(offset), size_t count);
+ #endif
  #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */
  
  /**
diff --combined include/linux/kexec.h
index fcd5035209f19a510d8ede7103e1ea161088574c,ebb1bffbf068c3a7380f3a14dcef6829a81178d3..ce6536f1d269970856ecabad52f7a7604f27e210
@@@ -193,6 -193,14 +193,6 @@@ void *kexec_purgatory_get_symbol_addr(s
  int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
                                  unsigned long buf_len);
  void *arch_kexec_kernel_image_load(struct kimage *image);
 -int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
 -                                   Elf_Shdr *section,
 -                                   const Elf_Shdr *relsec,
 -                                   const Elf_Shdr *symtab);
 -int arch_kexec_apply_relocations(struct purgatory_info *pi,
 -                               Elf_Shdr *section,
 -                               const Elf_Shdr *relsec,
 -                               const Elf_Shdr *symtab);
  int arch_kimage_file_post_load_cleanup(struct kimage *image);
  #ifdef CONFIG_KEXEC_SIG
  int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf,
@@@ -219,46 -227,8 +219,46 @@@ struct crash_mem 
  extern int crash_exclude_mem_range(struct crash_mem *mem,
                                   unsigned long long mstart,
                                   unsigned long long mend);
- extern int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map,
+ extern int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
                                       void **addr, unsigned long *sz);
 +
 +#ifndef arch_kexec_apply_relocations_add
 +/*
 + * arch_kexec_apply_relocations_add - apply relocations of type RELA
 + * @pi:               Purgatory to be relocated.
 + * @section:  Section relocations applying to.
 + * @relsec:   Section containing RELAs.
 + * @symtab:   Corresponding symtab.
 + *
 + * Return: 0 on success, negative errno on error.
 + */
 +static inline int
 +arch_kexec_apply_relocations_add(struct purgatory_info *pi, Elf_Shdr *section,
 +                               const Elf_Shdr *relsec, const Elf_Shdr *symtab)
 +{
 +      pr_err("RELA relocation unsupported.\n");
 +      return -ENOEXEC;
 +}
 +#endif
 +
 +#ifndef arch_kexec_apply_relocations
 +/*
 + * arch_kexec_apply_relocations - apply relocations of type REL
 + * @pi:               Purgatory to be relocated.
 + * @section:  Section relocations applying to.
 + * @relsec:   Section containing RELs.
 + * @symtab:   Corresponding symtab.
 + *
 + * Return: 0 on success, negative errno on error.
 + */
 +static inline int
 +arch_kexec_apply_relocations(struct purgatory_info *pi, Elf_Shdr *section,
 +                           const Elf_Shdr *relsec, const Elf_Shdr *symtab)
 +{
 +      pr_err("REL relocation unsupported.\n");
 +      return -ENOEXEC;
 +}
 +#endif
  #endif /* CONFIG_KEXEC_FILE */
  
  #ifdef CONFIG_KEXEC_ELF
diff --combined init/Kconfig
index 251aac1c0ccd3448915b051b0060f9a783f2c237,9fa3ee6bf12a6294b21f685765a32b68c7b9fd94..c984afc489dead0db3d4820b708d90f73b161553
@@@ -77,11 -77,6 +77,11 @@@ config CC_HAS_ASM_GOTO_OUTPU
        depends on CC_HAS_ASM_GOTO
        def_bool $(success,echo 'int foo(int x) { asm goto ("": "=r"(x) ::: bar); return x; bar: return 0; }' | $(CC) -x c - -c -o /dev/null)
  
 +config CC_HAS_ASM_GOTO_TIED_OUTPUT
 +      depends on CC_HAS_ASM_GOTO_OUTPUT
 +      # Detect buggy gcc and clang, fixed in gcc-11 clang-14.
 +      def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
 +
  config TOOLS_SUPPORT_RELR
        def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
  
@@@ -357,6 -352,23 +357,6 @@@ config DEFAULT_HOSTNAM
          but you may wish to use a different default here to make a minimal
          system more usable with less configuration.
  
 -#
 -# For some reason microblaze and nios2 hard code SWAP=n.  Hopefully we can
 -# add proper SWAP support to them, in which case this can be remove.
 -#
 -config ARCH_NO_SWAP
 -      bool
 -
 -config SWAP
 -      bool "Support for paging of anonymous memory (swap)"
 -      depends on MMU && BLOCK && !ARCH_NO_SWAP
 -      default y
 -      help
 -        This option allows you to choose whether you want to have support
 -        for so called swap devices or swap files in your kernel that are
 -        used to provide more virtual memory than the actual RAM present
 -        in your computer.  If unsure say Y.
 -
  config SYSVIPC
        bool "System V IPC"
        help
@@@ -378,6 -390,10 +378,10 @@@ config SYSVIPC_SYSCT
        depends on SYSCTL
        default y
  
+ config SYSVIPC_COMPAT
+       def_bool y
+       depends on COMPAT && SYSVIPC
  config POSIX_MQUEUE
        bool "POSIX Message Queues"
        depends on NET
@@@ -423,8 -439,8 +427,8 @@@ config CROSS_MEMORY_ATTAC
          See the man page for more details.
  
  config USELIB
 -      bool "uselib syscall"
 -      def_bool ALPHA || M68K || SPARC || X86_32 || IA32_EMULATION
 +      bool "uselib syscall (for libc5 and earlier)"
 +      default ALPHA || M68K || SPARC
        help
          This option enables the uselib syscall, a system call used in the
          dynamic linker from libc5 and earlier.  glibc does not use this
@@@ -703,7 -719,8 +707,7 @@@ config IKHEADER
  
  config LOG_BUF_SHIFT
        int "Kernel log buffer size (16 => 64KB, 17 => 128KB)"
 -      range 12 25 if !H8300
 -      range 12 19 if H8300
 +      range 12 25
        default 17
        depends on PRINTK
        help
@@@ -1338,7 -1355,7 +1342,7 @@@ endi
  
  config BOOT_CONFIG
        bool "Boot config support"
 -      select BLK_DEV_INITRD
 +      select BLK_DEV_INITRD if !BOOT_CONFIG_EMBED
        help
          Extra boot config allows system admin to pass a config file as
          complemental extension of kernel cmdline when booting.
  
          If unsure, say Y.
  
 +config BOOT_CONFIG_EMBED
 +      bool "Embed bootconfig file in the kernel"
 +      depends on BOOT_CONFIG
 +      help
 +        Embed a bootconfig file given by BOOT_CONFIG_EMBED_FILE in the
 +        kernel. Usually, the bootconfig file is loaded with the initrd
 +        image. But if the system doesn't support initrd, this option will
 +        help you by embedding a bootconfig file while building the kernel.
 +
 +        If unsure, say N.
 +
 +config BOOT_CONFIG_EMBED_FILE
 +      string "Embedded bootconfig file path"
 +      depends on BOOT_CONFIG_EMBED
 +      help
 +        Specify a bootconfig file which will be embedded to the kernel.
 +        This bootconfig will be used if there is no initrd or no other
 +        bootconfig in the initrd.
 +
 +config INITRAMFS_PRESERVE_MTIME
 +      bool "Preserve cpio archive mtimes in initramfs"
 +      default y
 +      help
 +        Each entry in an initramfs cpio archive carries an mtime value. When
 +        enabled, extracted cpio items take this mtime, with directory mtime
 +        setting deferred until after creation of any child entries.
 +
 +        If unsure, say Y.
 +
  choice
        prompt "Compiler optimization level"
        default CC_OPTIMIZE_FOR_PERFORMANCE
@@@ -1683,6 -1671,16 +1687,6 @@@ config ADVISE_SYSCALL
          applications use these syscalls, you can disable this option to save
          space.
  
 -config HAVE_ARCH_USERFAULTFD_WP
 -      bool
 -      help
 -        Arch has userfaultfd write protection support
 -
 -config HAVE_ARCH_USERFAULTFD_MINOR
 -      bool
 -      help
 -        Arch has userfaultfd minor fault support
 -
  config MEMBARRIER
        bool "Enable membarrier() system call" if EXPERT
        default y
@@@ -1747,6 -1745,13 +1751,6 @@@ config KALLSYMS_BASE_RELATIV
  
  # syscall, maps, verifier
  
 -config USERFAULTFD
 -      bool "Enable userfaultfd() system call"
 -      depends on MMU
 -      help
 -        Enable the userfaultfd() system call that allows to intercept and
 -        handle page faults in userland.
 -
  config ARCH_HAS_MEMBARRIER_CALLBACKS
        bool
  
@@@ -1861,6 -1866,165 +1865,6 @@@ config DEBUG_PERF_USE_VMALLO
  
  endmenu
  
 -config VM_EVENT_COUNTERS
 -      default y
 -      bool "Enable VM event counters for /proc/vmstat" if EXPERT
 -      help
 -        VM event counters are needed for event counts to be shown.
 -        This option allows the disabling of the VM event counters
 -        on EXPERT systems.  /proc/vmstat will only show page counts
 -        if VM event counters are disabled.
 -
 -config SLUB_DEBUG
 -      default y
 -      bool "Enable SLUB debugging support" if EXPERT
 -      depends on SLUB && SYSFS
 -      help
 -        SLUB has extensive debug support features. Disabling these can
 -        result in significant savings in code size. This also disables
 -        SLUB sysfs support. /sys/slab will not exist and there will be
 -        no support for cache validation etc.
 -
 -config COMPAT_BRK
 -      bool "Disable heap randomization"
 -      default y
 -      help
 -        Randomizing heap placement makes heap exploits harder, but it
 -        also breaks ancient binaries (including anything libc5 based).
 -        This option changes the bootup default to heap randomization
 -        disabled, and can be overridden at runtime by setting
 -        /proc/sys/kernel/randomize_va_space to 2.
 -
 -        On non-ancient distros (post-2000 ones) N is usually a safe choice.
 -
 -choice
 -      prompt "Choose SLAB allocator"
 -      default SLUB
 -      help
 -         This option allows to select a slab allocator.
 -
 -config SLAB
 -      bool "SLAB"
 -      depends on !PREEMPT_RT
 -      select HAVE_HARDENED_USERCOPY_ALLOCATOR
 -      help
 -        The regular slab allocator that is established and known to work
 -        well in all environments. It organizes cache hot objects in
 -        per cpu and per node queues.
 -
 -config SLUB
 -      bool "SLUB (Unqueued Allocator)"
 -      select HAVE_HARDENED_USERCOPY_ALLOCATOR
 -      help
 -         SLUB is a slab allocator that minimizes cache line usage
 -         instead of managing queues of cached objects (SLAB approach).
 -         Per cpu caching is realized using slabs of objects instead
 -         of queues of objects. SLUB can use memory efficiently
 -         and has enhanced diagnostics. SLUB is the default choice for
 -         a slab allocator.
 -
 -config SLOB
 -      depends on EXPERT
 -      bool "SLOB (Simple Allocator)"
 -      depends on !PREEMPT_RT
 -      help
 -         SLOB replaces the stock allocator with a drastically simpler
 -         allocator. SLOB is generally more space efficient but
 -         does not perform as well on large systems.
 -
 -endchoice
 -
 -config SLAB_MERGE_DEFAULT
 -      bool "Allow slab caches to be merged"
 -      default y
 -      depends on SLAB || SLUB
 -      help
 -        For reduced kernel memory fragmentation, slab caches can be
 -        merged when they share the same size and other characteristics.
 -        This carries a risk of kernel heap overflows being able to
 -        overwrite objects from merged caches (and more easily control
 -        cache layout), which makes such heap attacks easier to exploit
 -        by attackers. By keeping caches unmerged, these kinds of exploits
 -        can usually only damage objects in the same cache. To disable
 -        merging at runtime, "slab_nomerge" can be passed on the kernel
 -        command line.
 -
 -config SLAB_FREELIST_RANDOM
 -      bool "Randomize slab freelist"
 -      depends on SLAB || SLUB
 -      help
 -        Randomizes the freelist order used on creating new pages. This
 -        security feature reduces the predictability of the kernel slab
 -        allocator against heap overflows.
 -
 -config SLAB_FREELIST_HARDENED
 -      bool "Harden slab freelist metadata"
 -      depends on SLAB || SLUB
 -      help
 -        Many kernel heap attacks try to target slab cache metadata and
 -        other infrastructure. This options makes minor performance
 -        sacrifices to harden the kernel slab allocator against common
 -        freelist exploit methods. Some slab implementations have more
 -        sanity-checking than others. This option is most effective with
 -        CONFIG_SLUB.
 -
 -config SHUFFLE_PAGE_ALLOCATOR
 -      bool "Page allocator randomization"
 -      default SLAB_FREELIST_RANDOM && ACPI_NUMA
 -      help
 -        Randomization of the page allocator improves the average
 -        utilization of a direct-mapped memory-side-cache. See section
 -        5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
 -        6.2a specification for an example of how a platform advertises
 -        the presence of a memory-side-cache. There are also incidental
 -        security benefits as it reduces the predictability of page
 -        allocations to compliment SLAB_FREELIST_RANDOM, but the
 -        default granularity of shuffling on the "MAX_ORDER - 1" i.e,
 -        10th order of pages is selected based on cache utilization
 -        benefits on x86.
 -
 -        While the randomization improves cache utilization it may
 -        negatively impact workloads on platforms without a cache. For
 -        this reason, by default, the randomization is enabled only
 -        after runtime detection of a direct-mapped memory-side-cache.
 -        Otherwise, the randomization may be force enabled with the
 -        'page_alloc.shuffle' kernel command line parameter.
 -
 -        Say Y if unsure.
 -
 -config SLUB_CPU_PARTIAL
 -      default y
 -      depends on SLUB && SMP
 -      bool "SLUB per cpu partial cache"
 -      help
 -        Per cpu partial caches accelerate objects allocation and freeing
 -        that is local to a processor at the price of more indeterminism
 -        in the latency of the free. On overflow these caches will be cleared
 -        which requires the taking of locks that may cause latency spikes.
 -        Typically one would choose no for a realtime system.
 -
 -config MMAP_ALLOW_UNINITIALIZED
 -      bool "Allow mmapped anonymous memory to be uninitialized"
 -      depends on EXPERT && !MMU
 -      default n
 -      help
 -        Normally, and according to the Linux spec, anonymous memory obtained
 -        from mmap() has its contents cleared before it is passed to
 -        userspace.  Enabling this config option allows you to request that
 -        mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
 -        providing a huge performance boost.  If this option is not enabled,
 -        then the flag will be ignored.
 -
 -        This is taken advantage of by uClibc's malloc(), and also by
 -        ELF-FDPIC binfmt's brk and stack allocator.
 -
 -        Because of the obvious security issues, this option should only be
 -        enabled on embedded devices where you control what is run in
 -        userspace.  Since that isn't generally a problem on no-MMU systems,
 -        it is normally safe to say Y here.
 -
 -        See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
 -
  config SYSTEM_DATA_VERIFICATION
        def_bool n
        select SYSTEM_TRUSTED_KEYRING
@@@ -1958,17 -2122,6 +1962,17 @@@ config MODULE_FORCE_UNLOA
          rmmod).  This is mainly for kernel developers and desperate users.
          If unsure, say N.
  
 +config MODULE_UNLOAD_TAINT_TRACKING
 +      bool "Tainted module unload tracking"
 +      depends on MODULE_UNLOAD
 +      default n
 +      help
 +        This option allows you to maintain a record of each unloaded
 +        module that tainted the kernel. In addition to displaying a
 +        list of linked (or loaded) modules e.g. on detection of a bad
 +        page (see bad_page()), the aforementioned details are also
 +        shown. If unsure, say N.
 +
  config MODVERSIONS
        bool "Module versioning support"
        help
@@@ -1987,6 -2140,10 +1991,6 @@@ config ASM_MODVERSION
          assembly. This can be enabled only when the target architecture
          supports it.
  
 -config MODULE_REL_CRCS
 -      bool
 -      depends on MODVERSIONS
 -
  config MODULE_SRCVERSION_ALL
        bool "Source checksum for all modules"
        help
diff --combined kernel/kexec_file.c
index c108a2a8875463479a5df735250d68b5aebc13a9,331a4f0f10f51d0da734e0898622ac99e19f6364..145321a5e798a647f299b1728a61231d166621ce
@@@ -108,6 -108,40 +108,6 @@@ int __weak arch_kexec_kernel_verify_sig
  }
  #endif
  
 -/*
 - * arch_kexec_apply_relocations_add - apply relocations of type RELA
 - * @pi:               Purgatory to be relocated.
 - * @section:  Section relocations applying to.
 - * @relsec:   Section containing RELAs.
 - * @symtab:   Corresponding symtab.
 - *
 - * Return: 0 on success, negative errno on error.
 - */
 -int __weak
 -arch_kexec_apply_relocations_add(struct purgatory_info *pi, Elf_Shdr *section,
 -                               const Elf_Shdr *relsec, const Elf_Shdr *symtab)
 -{
 -      pr_err("RELA relocation unsupported.\n");
 -      return -ENOEXEC;
 -}
 -
 -/*
 - * arch_kexec_apply_relocations - apply relocations of type REL
 - * @pi:               Purgatory to be relocated.
 - * @section:  Section relocations applying to.
 - * @relsec:   Section containing RELs.
 - * @symtab:   Corresponding symtab.
 - *
 - * Return: 0 on success, negative errno on error.
 - */
 -int __weak
 -arch_kexec_apply_relocations(struct purgatory_info *pi, Elf_Shdr *section,
 -                           const Elf_Shdr *relsec, const Elf_Shdr *symtab)
 -{
 -      pr_err("REL relocation unsupported.\n");
 -      return -ENOEXEC;
 -}
 -
  /*
   * Free up memory used by kernel, initrd, and command line. This is temporary
   * memory allocation which is not needed any more after these buffers have
@@@ -1226,7 -1260,7 +1226,7 @@@ int crash_exclude_mem_range(struct cras
        return 0;
  }
  
- int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map,
+ int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
                          void **addr, unsigned long *sz)
  {
        Elf64_Ehdr *ehdr;
        phdr++;
  
        /* Prepare PT_LOAD type program header for kernel text region */
-       if (kernel_map) {
+       if (need_kernel_map) {
                phdr->p_type = PT_LOAD;
                phdr->p_flags = PF_R|PF_W|PF_X;
                phdr->p_vaddr = (unsigned long) _text;
diff --combined mm/readahead.c
index b78921b547547a4c6d2150996306140971fe0f1a,a9ba3bb19ad0cd42909d2b81e61cc34b37c4d8c2..415c39d764eaebc0696f270ef5a98117c8e51348
@@@ -15,7 -15,7 +15,7 @@@
   * explicitly requested by the application.  Readahead only ever
   * attempts to read folios that are not yet in the page cache.  If a
   * folio is present but not up-to-date, readahead will not try to read
 - * it. In that case a simple ->readpage() will be requested.
 + * it. In that case a simple ->read_folio() will be requested.
   *
   * Readahead is triggered when an application read request (whether a
   * system call or a page fault) finds that the requested folio is not in
@@@ -78,7 -78,7 +78,7 @@@
   * address space operation, for which mpage_readahead() is a canonical
   * implementation.  ->readahead() should normally initiate reads on all
   * folios, but may fail to read any or all folios without causing an I/O
 - * error.  The page cache reading code will issue a ->readpage() request
 + * error.  The page cache reading code will issue a ->read_folio() request
   * for any folio which ->readahead() did not read, and only an error
   * from this will be final.
   *
   * were not fetched with readahead_folio().  This will allow a
   * subsequent synchronous readahead request to try them again.  If they
   * are left in the page cache, then they will be read individually using
 - * ->readpage() which may be less efficient.
 + * ->read_folio() which may be less efficient.
   */
  
 +#include <linux/blkdev.h>
  #include <linux/kernel.h>
  #include <linux/dax.h>
  #include <linux/gfp.h>
@@@ -146,7 -145,7 +146,7 @@@ EXPORT_SYMBOL_GPL(file_ra_state_init)
  static void read_pages(struct readahead_control *rac)
  {
        const struct address_space_operations *aops = rac->mapping->a_ops;
 -      struct page *page;
 +      struct folio *folio;
        struct blk_plug plug;
  
        if (!readahead_count(rac))
        if (aops->readahead) {
                aops->readahead(rac);
                /*
 -               * Clean up the remaining pages.  The sizes in ->ra
 +               * Clean up the remaining folios.  The sizes in ->ra
                 * may be used to size the next readahead, so make sure
                 * they accurately reflect what happened.
                 */
 -              while ((page = readahead_page(rac))) {
 -                      rac->ra->size -= 1;
 -                      if (rac->ra->async_size > 0) {
 -                              rac->ra->async_size -= 1;
 -                              delete_from_page_cache(page);
 +              while ((folio = readahead_folio(rac)) != NULL) {
 +                      unsigned long nr = folio_nr_pages(folio);
 +
 +                      rac->ra->size -= nr;
 +                      if (rac->ra->async_size >= nr) {
 +                              rac->ra->async_size -= nr;
 +                              filemap_remove_folio(folio);
                        }
 -                      unlock_page(page);
 -                      put_page(page);
 +                      folio_unlock(folio);
                }
        } else {
 -              while ((page = readahead_page(rac))) {
 -                      aops->readpage(rac->file, page);
 -                      put_page(page);
 -              }
 +              while ((folio = readahead_folio(rac)) != NULL)
 +                      aops->read_folio(rac->file, folio);
        }
  
        blk_finish_plug(&plug);
@@@ -254,8 -254,8 +254,8 @@@ void page_cache_ra_unbounded(struct rea
        }
  
        /*
 -       * Now start the IO.  We ignore I/O errors - if the page is not
 -       * uptodate then the caller will launch readpage again, and
 +       * Now start the IO.  We ignore I/O errors - if the folio is not
 +       * uptodate then the caller will launch read_folio again, and
         * will then handle the error.
         */
        read_pages(ractl);
@@@ -303,7 -303,7 +303,7 @@@ void force_page_cache_ra(struct readahe
        struct backing_dev_info *bdi = inode_to_bdi(mapping->host);
        unsigned long max_pages, index;
  
 -      if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readahead))
 +      if (unlikely(!mapping->a_ops->read_folio && !mapping->a_ops->readahead))
                return;
  
        /*
@@@ -474,8 -474,7 +474,8 @@@ static inline int ra_alloc_folio(struc
  
        if (!folio)
                return -ENOMEM;
 -      if (mark - index < (1UL << order))
 +      mark = round_up(mark, 1UL << order);
 +      if (index == mark)
                folio_set_readahead(folio);
        err = filemap_add_folio(ractl->mapping, folio, index, gfp);
        if (err)
@@@ -556,9 -555,8 +556,9 @@@ static void ondemand_readahead(struct r
        struct file_ra_state *ra = ractl->ra;
        unsigned long max_pages = ra->ra_pages;
        unsigned long add_pages;
 -      unsigned long index = readahead_index(ractl);
 -      pgoff_t prev_index;
 +      pgoff_t index = readahead_index(ractl);
 +      pgoff_t expected, prev_index;
 +      unsigned int order = folio ? folio_order(folio) : 0;
  
        /*
         * If the request exceeds the readahead window, allow the read to
         * It's the expected callback index, assume sequential access.
         * Ramp up sizes, and push forward the readahead window.
         */
 -      if ((index == (ra->start + ra->size - ra->async_size) ||
 -           index == (ra->start + ra->size))) {
 +      expected = round_up(ra->start + ra->size - ra->async_size,
 +                      1UL << order);
 +      if (index == expected || index == (ra->start + ra->size)) {
                ra->start += ra->size;
                ra->size = get_next_ra_size(ra, max_pages);
                ra->async_size = ra->size;
@@@ -665,7 -662,7 +665,7 @@@ readit
        }
  
        ractl->_index = ra->start;
 -      page_cache_ra_order(ractl, ra, folio ? folio_order(folio) : 0);
 +      page_cache_ra_order(ractl, ra, order);
  }
  
  void page_cache_sync_ra(struct readahead_control *ractl,
@@@ -749,6 -746,13 +749,13 @@@ SYSCALL_DEFINE3(readahead, int, fd, lof
        return ksys_readahead(fd, offset, count);
  }
  
+ #if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_READAHEAD)
+ COMPAT_SYSCALL_DEFINE4(readahead, int, fd, compat_arg_u64_dual(offset), size_t, count)
+ {
+       return ksys_readahead(fd, compat_arg_u64_glue(offset), count);
+ }
+ #endif
  /**
   * readahead_expand - Expand a readahead request
   * @ractl: The request to be expanded
This page took 0.250796 seconds and 4 git commands to generate.