Skip to content
  1. Apr 23, 2022
    • Mark Brown's avatar
      arm64/sme: Implement ptrace support for streaming mode SVE registers · e12310a0
      Mark Brown authored
      
      
      The streaming mode SVE registers are represented using the same data
      structures as for SVE but since the vector lengths supported and in use
      may not be the same as SVE we represent them with a new type NT_ARM_SSVE.
      Unfortunately we only have a single 16 bit reserved field available in
      the header so there is no space to fit the current and maximum vector
      length for both standard and streaming SVE mode without redefining the
      structure in a way the creates a complicatd and fragile ABI. Since FFR
      is not present in streaming mode it is read and written as zero.
      
      Setting NT_ARM_SSVE registers will put the task into streaming mode,
      similarly setting NT_ARM_SVE registers will exit it. Reads that do not
      correspond to the current mode of the task will return the header with
      no register data. For compatibility reasons on write setting no flag for
      the register type will be interpreted as setting SVE registers, though
      users can provide no register data as an alternative mechanism for doing
      so.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-21-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      e12310a0
    • Mark Brown's avatar
      arm64/sme: Implement ZA signal handling · 39782210
      Mark Brown authored
      
      
      Implement support for ZA in signal handling in a very similar way to how
      we implement support for SVE registers, using a signal context structure
      with optional register state after it. Where present this register state
      stores the ZA matrix as a series of horizontal vectors numbered from 0 to
      VL/8 in the endinanness independent format used for vectors.
      
      As with SVE we do not allow changes in the vector length during signal
      return but we do allow ZA to be enabled or disabled.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-20-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      39782210
    • Mark Brown's avatar
      arm64/sme: Implement streaming SVE signal handling · 85ed24da
      Mark Brown authored
      
      
      When in streaming mode we have the same set of SVE registers as we do in
      regular SVE mode with the exception of FFR and the use of the SME vector
      length. Provide signal handling for these registers by taking one of the
      reserved words in the SVE signal context as a flags field and defining a
      flag which is set for streaming mode. When the flag is set the vector
      length is set to the streaming mode vector length and we save and
      restore streaming mode data. We support entering or leaving streaming
      mode based on the value of the flag but do not support changing the
      vector length, this is not currently supported SVE signal handling.
      
      We could instead allocate a separate record in the signal frame for the
      streaming mode SVE context but this inflates the size of the maximal signal
      frame required and adds complication when validating signal frames from
      userspace, especially given the current structure of the code.
      
      Any implementation of support for streaming mode vectors in signals will
      have some potential for causing issues for applications that attempt to
      handle SVE vectors in signals, use streaming mode but do not understand
      streaming mode in their signal handling code, it is hard to identify a
      case that is clearly better than any other - they all have cases where
      they could cause unexpected register corruption or faults.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-19-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      85ed24da
    • Mark Brown's avatar
      arm64/sme: Disable ZA and streaming mode when handling signals · 40a8e87b
      Mark Brown authored
      
      
      The ABI requires that streaming mode and ZA are disabled when invoking
      signal handlers, do this in setup_return() when we prepare the task state
      for the signal handler.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-18-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      40a8e87b
    • Mark Brown's avatar
      arm64/sme: Implement traps and syscall handling for SME · 8bd7f91c
      Mark Brown authored
      
      
      By default all SME operations in userspace will trap.  When this happens
      we allocate storage space for the SME register state, set up the SVE
      registers and disable traps.  We do not need to initialize ZA since the
      architecture guarantees that it will be zeroed when enabled and when we
      trap ZA is disabled.
      
      On syscall we exit streaming mode if we were previously in it and ensure
      that all but the lower 128 bits of the registers are zeroed while
      preserving the state of ZA. This follows the aarch64 PCS for SME, ZA
      state is preserved over a function call and streaming mode is exited.
      Since the traps for SME do not distinguish between streaming mode SVE
      and ZA usage if ZA is in use rather than reenabling traps we instead
      zero the parts of the SVE registers not shared with FPSIMD and leave SME
      enabled, this simplifies handling SME traps. If ZA is not in use then we
      reenable SME traps and fall through to normal handling of SVE.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-17-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      8bd7f91c
    • Mark Brown's avatar
      arm64/sme: Implement ZA context switching · 0033cd93
      Mark Brown authored
      
      
      Allocate space for storing ZA on first access to SME and use that to save
      and restore ZA state when context switching. We do this by using the vector
      form of the LDR and STR ZA instructions, these do not require streaming
      mode and have implementation recommendations that they avoid contention
      issues in shared SMCU implementations.
      
      Since ZA is architecturally guaranteed to be zeroed when enabled we do not
      need to explicitly zero ZA, either we will be restoring from a saved copy
      or trapping on first use of SME so we know that ZA must be disabled.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-16-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      0033cd93
    • Mark Brown's avatar
      arm64/sme: Implement streaming SVE context switching · af7167d6
      Mark Brown authored
      
      
      When in streaming mode we need to save and restore the streaming mode
      SVE register state rather than the regular SVE register state. This uses
      the streaming mode vector length and omits FFR but is otherwise identical,
      if TIF_SVE is enabled when we are in streaming mode then streaming mode
      takes precedence.
      
      This does not handle use of streaming SVE state with KVM, ptrace or
      signals. This will be updated in further patches.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-15-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      af7167d6
    • Mark Brown's avatar
      arm64/sme: Implement SVCR context switching · b40c559b
      Mark Brown authored
      
      
      In SME the use of both streaming SVE mode and ZA are tracked through
      PSTATE.SM and PSTATE.ZA, visible through the system register SVCR.  In
      order to context switch the floating point state for SME we need to
      context switch the contents of this register as part of context
      switching the floating point state.
      
      Since changing the vector length exits streaming SVE mode and disables
      ZA we also make sure we update SVCR appropriately when setting vector
      length, and similarly ensure that new threads have streaming SVE mode
      and ZA disabled.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-14-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      b40c559b
    • Mark Brown's avatar
      arm64/sme: Implement support for TPIDR2 · a9d69158
      Mark Brown authored
      
      
      The Scalable Matrix Extension introduces support for a new thread specific
      data register TPIDR2 intended for use by libc. The kernel must save the
      value of TPIDR2 on context switch and should ensure that all new threads
      start off with a default value of 0. Add a field to the thread_struct to
      store TPIDR2 and context switch it with the other thread specific data.
      
      In case there are future extensions which also use TPIDR2 we introduce
      system_supports_tpidr2() and use that rather than system_supports_sme()
      for TPIDR2 handling.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-13-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      a9d69158
    • Mark Brown's avatar
      arm64/sme: Implement vector length configuration prctl()s · 9e4ab6c8
      Mark Brown authored
      
      
      As for SVE provide a prctl() interface which allows processes to
      configure their SME vector length.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-12-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      9e4ab6c8
    • Mark Brown's avatar
      arm64/sme: Implement sysctl to set the default vector length · 12f1bacf
      Mark Brown authored
      
      
      As for SVE provide a sysctl which allows the default SME vector length to
      be configured.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-11-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      12f1bacf
    • Mark Brown's avatar
      arm64/sme: Identify supported SME vector lengths at boot · b42990d3
      Mark Brown authored
      
      
      The vector lengths used for SME are controlled through a similar set of
      registers to those for SVE and enumerated using a similar algorithm with
      some slight differences due to the fact that unlike SVE there are no
      restrictions on which combinations of vector lengths can be supported
      nor any mandatory vector lengths which must be implemented.  Add a new
      vector type and implement support for enumerating it.
      
      One slightly awkward feature is that we need to read the current vector
      length using a different instruction (or enter streaming mode which
      would have the same issue and be higher cost).  Rather than add an ops
      structure we add special cases directly in the otherwise generic
      vec_probe_vqs() function, this is a bit inelegant but it's the only
      place where this is an issue.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-10-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      b42990d3
    • Mark Brown's avatar
      arm64/sme: Basic enumeration support · 5e64b862
      Mark Brown authored
      
      
      This patch introduces basic cpufeature support for discovering the presence
      of the Scalable Matrix Extension.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-9-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      5e64b862
    • Mark Brown's avatar
      arm64/sme: Early CPU setup for SME · b2cf6a23
      Mark Brown authored
      
      
      SME requires similar setup to that for SVE: disable traps to EL2 and
      make sure that the maximum vector length is available to EL1, for SME we
      have two traps - one for SME itself and one for TPIDR2.
      
      In addition since we currently make no active use of priority control
      for SCMUs we map all SME priorities lower ELs may configure to 0, the
      architecture specified minimum priority, to ensure that nothing we
      manage is able to configure itself to consume excessive resources.  This
      will need to be revisited should there be a need to manage SME
      priorities at runtime.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-8-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      b2cf6a23
    • Mark Brown's avatar
      arm64/sme: Manually encode SME instructions · ca8a4ebc
      Mark Brown authored
      
      
      As with SVE rather than impose ambitious toolchain requirements for SME
      we manually encode the few instructions which we require in order to
      perform the work the kernel needs to do. The instructions used to save
      and restore context are provided as assembler macros while those for
      entering and leaving streaming mode are done in asm volatile blocks
      since they are expected to be used from C.
      
      We could do the SMSTART and SMSTOP operations with read/modify/write
      cycles on SVCR but using the aliases provided for individual field
      accesses should be slightly faster. These instructions are aliases for
      MSR but since our minimum toolchain requirements are old enough to mean
      that we can't use the sX_X_cX_cX_X form and they always use xzr rather
      than taking a value like write_sysreg_s() wants we just use .inst.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-7-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      ca8a4ebc
    • Mark Brown's avatar
      arm64/sme: System register and exception syndrome definitions · b4adc83b
      Mark Brown authored
      
      
      The arm64 Scalable Matrix Extension (SME) adds some new system registers,
      fields in existing system registers and exception syndromes. This patch
      adds definitions for these for use in future patches implementing support
      for this extension.
      
      Since SME will be the first user of FEAT_HCX in the kernel also include
      the definitions for enumerating it and the HCRX system register it adds.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-6-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      b4adc83b
    • Mark Brown's avatar
      arm64/sme: Provide ABI documentation for SME · 96d32e63
      Mark Brown authored
      
      
      Provide ABI documentation for SME similar to that for SVE. Due to the very
      large overlap around streaming SVE mode in both implementation and
      interfaces documentation for streaming mode SVE is added to the SVE
      document rather than the SME one.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarSzabolcs Nagy <szabolcs.nagy@arm.com>
      Link: https://lore.kernel.org/r/20220419112247.711548-5-broonie@kernel.org
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      96d32e63
  2. Apr 18, 2022
    • Linus Torvalds's avatar
      Linux 5.18-rc3 · b2d229d4
      Linus Torvalds authored
      b2d229d4
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.18-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · a1901b46
      Linus Torvalds authored
      Pull xen fixlet from Juergen Gross:
       "A single cleanup patch for the Xen balloon driver"
      
      * tag 'for-linus-5.18-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/balloon: don't use PV mode extra memory for zone device allocations
      a1901b46
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3a69a442
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "Two x86 fixes related to TSX:
      
         - Use either MSR_TSX_FORCE_ABORT or MSR_IA32_TSX_CTRL to disable TSX
           to cover all CPUs which allow to disable it.
      
         - Disable TSX development mode at boot so that a microcode update
           which provides TSX development mode does not suddenly make the
           system vulnerable to TSX Asynchronous Abort"
      
      * tag 'x86-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/tsx: Disable TSX development mode at boot
        x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits
      3a69a442
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · fbb9c58e
      Linus Torvalds authored
      Pull timer fixes from Thomas Gleixner:
       "A small set of fixes for the timers core:
      
         - Fix the warning condition in __run_timers() which does not take
           into account that a CPU base (especially the deferrable base) never
           has a timer armed on it and therefore the next_expiry value can
           become stale.
      
         - Replace a WARN_ON() in the NOHZ code with a WARN_ON_ONCE() to
           prevent endless spam in dmesg.
      
         - Remove the double star from a comment which is not meant to be in
           kernel-doc format"
      
      * tag 'timers-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        tick/sched: Fix non-kernel-doc comment
        tick/nohz: Use WARN_ON_ONCE() to prevent console saturation
        timers: Fix warning condition in __run_timers()
      fbb9c58e
    • Linus Torvalds's avatar
      Merge tag 'smp-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0e59732e
      Linus Torvalds authored
      Pull SMP fixes from Thomas Gleixner:
       "Two fixes for the SMP core:
      
         - Make the warning condition in flush_smp_call_function_queue()
           correct, which checked a just emptied list head for being empty
           instead of validating that there was no pending entry on the
           offlined CPU at all.
      
         - The @cpu member of struct cpuhp_cpu_state is initialized when the
           CPU hotplug thread for the upcoming CPU is created. That's too late
           because the creation of the thread can fail and then the following
           rollback operates on CPU0. Get rid of the CPU member and hand the
           CPU number to the involved functions directly"
      
      * tag 'smp-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state
        smp: Fix offline cpu check in flush_smp_call_function_queue()
      0e59732e
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7e1777f5
      Linus Torvalds authored
      Pull irq fix from Thomas Gleixner:
       "A single fix for the interrupt affinity spreading logic to take into
        account that there can be an imbalance between present and possible
        CPUs, which causes already assigned bits to be overwritten"
      
      * tag 'irq-urgent-2022-04-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq/affinity: Consider that CPUs on nodes can be unbalanced
      7e1777f5
    • Linus Torvalds's avatar
      Merge tag 'for-v5.18-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply · 9a921a6f
      Linus Torvalds authored
      Pull power supply fixes from Sebastian Reichel:
      
       - Fix a regression with battery data failing to load from DT
      
      * tag 'for-v5.18-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
        power: supply: Reset err after not finding static battery
        power: supply: samsung-sdi-battery: Add missing charge restart voltages
      9a921a6f
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · bd0c7d75
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Regular set of fixes for drivers and the dev-interface"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: ismt: Fix undefined behavior due to shift overflowing the constant
        i2c: dev: Force case user pointers in compat_i2cdev_ioctl()
        i2c: dev: check return value when calling dev_set_name()
        i2c: qcom-geni: Use dev_err_probe() for GPI DMA error
        i2c: imx: Implement errata ERR007805 or e7805 bus frequency limit
        i2c: pasemi: Wait for write xfers to finish
      bd0c7d75
  3. Apr 17, 2022
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · a2c29ccd
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Fix scalar property schemas with array constraints
      
       - Fix 'enum' lists with duplicate entries
      
       - Fix incomplete if/then/else schemas
      
       - Add Renesas RZ/V2L SoC support to Mali Bifrost binding
      
       - Maintainers update for Marvell irqchip
      
      * tag 'devicetree-fixes-for-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: display: panel-timing: Define a single type for properties
        dt-bindings: Fix array constraints on scalar properties
        dt-bindings: gpu: mali-bifrost: Document RZ/V2L SoC
        dt-bindings: net: snps: remove duplicate name
        dt-bindings: Fix 'enum' lists with duplicate entries
        dt-bindings: irqchip: mrvl,intc: refresh maintainers
        dt-bindings: Fix incomplete if/then/else schemas
        dt-bindings: power: renesas,apmu: Fix cpus property limits
        dt-bindings: extcon: maxim,max77843: fix ports type
      a2c29ccd
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · de6e9336
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
       "A single fix for gpio-sim and two patches for GPIO ACPI pulled from
        Andy:
      
         - fix the set/get_multiple() callbacks in gpio-sim
      
         - use correct format characters in gpiolib-acpi
      
         - use an unsigned type for pins in gpiolib-acpi"
      
      * tag 'gpio-fixes-for-v5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: sim: fix setting and getting multiple lines
        gpiolib: acpi: Convert type for pin to be unsigned
        gpiolib: acpi: use correct format characters
      de6e9336
    • Linus Torvalds's avatar
      Merge tag 'soc-fixes-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 70a0cec8
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "There are a number of SoC bugfixes that came in since the merge
        window, and more of them are already pending.
      
        This batch includes:
      
         - A boot time regression fix for davinci that triggered on
           multi_v5_defconfig when booting any platform
      
         - Defconfig updates to address removed features, changed symbol names
           or dependencies, for gemini, ux500, and pxa
      
         - Email address changes for Krzysztof Kozlowski
      
         - Build warning fixes for ep93xx and iop32x
      
         - Devicetree warning fixes across many platforms
      
         - Minor bugfixes for the reset controller, memory controller and SCMI
           firmware subsystems plus the versatile-express board"
      
      * tag 'soc-fixes-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (34 commits)
        ARM: config: Update Gemini defconfig
        arm64: dts: qcom/sdm845-shift-axolotl: Fix boolean properties with values
        ARM: dts: align SPI NOR node name with dtschema
        ARM: dts: Fix more boolean properties with values
        arm/arm64: dts: qcom: Fix boolean properties with values
        arm64: dts: imx: Fix imx8*-var-som touchscreen property sizes
        arm: dts: imx: Fix boolean properties with values
        arm64: dts: tegra: Fix boolean properties with values
        arm: dts: at91: Fix boolean properties with values
        arm: configs: imote2: Drop defconfig as board support dropped.
        ep93xx: clock: Don't use plain integer as NULL pointer
        ep93xx: clock: Fix UAF in ep93xx_clk_register_gate()
        ARM: vexpress/spc: Fix all the kernel-doc build warnings
        ARM: vexpress/spc: Fix kernel-doc build warning for ve_spc_cpu_in_wfi
        ARM: config: u8500: Re-enable AB8500 battery charging
        ARM: config: u8500: Add some common hardware
        memory: fsl_ifc: populate child nodes of buses and mfd devices
        ARM: config: Refresh U8500 defconfig
        firmware: arm_scmi: Fix sparse warnings in OPTEE transport driver
        firmware: arm_scmi: Replace zero-length array with flexible-array member
        ...
      70a0cec8
    • Linus Torvalds's avatar
      Merge tag 'random-5.18-rc3-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random · 92edbe32
      Linus Torvalds authored
      Pull random number generator fixes from Jason Donenfeld:
      
       - Per your suggestion, random reads now won't fail if there's a page
         fault after some non-zero amount of data has been read, which makes
         the behavior consistent with all other reads in the kernel.
      
       - Rather than an inconsistent mix of random_get_entropy() returning an
         unsigned long or a cycles_t, now it just returns an unsigned long.
      
       - A memcpy() was replaced with an memmove(), because the addresses are
         sometimes overlapping. In practice the destination is always before
         the source, so not really an issue, but better to be correct than
         not.
      
      * tag 'random-5.18-rc3-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random:
        random: use memmove instead of memcpy for remaining 32 bytes
        random: make random_get_entropy() return an unsigned long
        random: allow partial reads if later user copies fail
      92edbe32
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 90ea17a9
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "13 fixes, all in drivers.
      
        The most extensive changes are in the iscsi series (affecting drivers
        qedi, cxgbi and bnx2i), the next most is scsi_debug, but that's just a
        simple revert and then minor updates to pm80xx"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: iscsi: MAINTAINERS: Add Mike Christie as co-maintainer
        scsi: qedi: Fix failed disconnect handling
        scsi: iscsi: Fix NOP handling during conn recovery
        scsi: iscsi: Merge suspend fields
        scsi: iscsi: Fix unbound endpoint error handling
        scsi: iscsi: Fix conn cleanup and stop race during iscsid restart
        scsi: iscsi: Fix endpoint reuse regression
        scsi: iscsi: Release endpoint ID when its freed
        scsi: iscsi: Fix offload conn cleanup when iscsid restarts
        scsi: iscsi: Move iscsi_ep_disconnect()
        scsi: pm80xx: Enable upper inbound, outbound queues
        scsi: pm80xx: Mask and unmask upper interrupt vectors 32-63
        Revert "scsi: scsi_debug: Address races following module load"
      90ea17a9
    • Bartosz Golaszewski's avatar
      Merge tag 'intel-gpio-v5.18-2' of... · 0ebb4fbe
      Bartosz Golaszewski authored
      Merge tag 'intel-gpio-v5.18-2' of gitolite.kernel.org:pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-current
      
      intel-gpio for v5.18-2
      
      * Couple of fixes related to handling unsigned value of the pin from ACPI
      
      gpiolib:
       -  acpi: Convert type for pin to be unsigned
       -  acpi: use correct format characters
      0ebb4fbe
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.18-2' of git://git.infradead.org/users/hch/dma-mapping · b0086839
      Linus Torvalds authored
      Pull dma-mapping fix from Christoph Hellwig:
      
       - avoid a double memory copy for swiotlb (Chao Gao)
      
      * tag 'dma-mapping-5.18-2' of git://git.infradead.org/users/hch/dma-mapping:
        dma-direct: avoid redundant memory sync for swiotlb
      b0086839
  4. Apr 16, 2022
    • Jason A. Donenfeld's avatar
      random: use memmove instead of memcpy for remaining 32 bytes · 35a33ff3
      Jason A. Donenfeld authored
      
      
      In order to immediately overwrite the old key on the stack, before
      servicing a userspace request for bytes, we use the remaining 32 bytes
      of block 0 as the key. This means moving indices 8,9,a,b,c,d,e,f ->
      4,5,6,7,8,9,a,b. Since 4 < 8, for the kernel implementations of
      memcpy(), this doesn't actually appear to be a problem in practice. But
      relying on that characteristic seems a bit brittle. So let's change that
      to a proper memmove(), which is the by-the-books way of handling
      overlapping memory copies.
      
      Reviewed-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      35a33ff3
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 59250f8a
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "14 patches.
      
        Subsystems affected by this patch series: MAINTAINERS, binfmt, and
        mm (tmpfs, secretmem, kasan, kfence, pagealloc, zram, compaction,
        hugetlb, vmalloc, and kmemleak)"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm: kmemleak: take a full lowmem check in kmemleak_*_phys()
        mm/vmalloc: fix spinning drain_vmap_work after reading from /proc/vmcore
        revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE"
        revert "fs/binfmt_elf: fix PT_LOAD p_align values for loaders"
        hugetlb: do not demote poisoned hugetlb pages
        mm: compaction: fix compiler warning when CONFIG_COMPACTION=n
        mm: fix unexpected zeroed page mapping with zram swap
        mm, page_alloc: fix build_zonerefs_node()
        mm, kfence: support kmem_dump_obj() for KFENCE objects
        kasan: fix hw tags enablement when KUNIT tests are disabled
        irq_work: use kasan_record_aux_stack_noalloc() record callstack
        mm/secretmem: fix panic when growing a memfd_secret
        tmpfs: fix regressions from wider use of ZERO_PAGE
        MAINTAINERS: Broadcom internal lists aren't maintainers
      59250f8a
    • Linus Torvalds's avatar
      Merge tag 'for-5.18/dm-fixes-2' of... · ce673f63
      Linus Torvalds authored
      Merge tag 'for-5.18/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper fixes from Mike Snitzer:
      
       - Fix memory corruption in DM integrity target when tag_size is less
         than digest size.
      
       - Fix DM multipath's historical-service-time path selector to not use
         sched_clock() and ktime_get_ns(); only use ktime_get_ns().
      
       - Fix dm_io->orig_bio NULL pointer dereference in dm_zone_map_bio() due
         to 5.18 changes that overlooked DM zone's use of ->orig_bio
      
       - Fix for regression that broke the use of dm_accept_partial_bio() for
         "abnormal" IO (e.g. WRITE ZEROES) that does not need duplicate bios
      
       - Fix DM's issuing of empty flush bio so that it's size is 0.
      
      * tag 'for-5.18/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm: fix bio length of empty flush
        dm: allow dm_accept_partial_bio() for dm_io without duplicate bios
        dm zone: fix NULL pointer dereference in dm_zone_map_bio
        dm mpath: only use ktime_get_ns() in historical selector
        dm integrity: fix memory corruption when tag_size is less than digest size
      ce673f63
    • Patrick Wang's avatar
      mm: kmemleak: take a full lowmem check in kmemleak_*_phys() · 23c2d497
      Patrick Wang authored
      
      
      The kmemleak_*_phys() apis do not check the address for lowmem's min
      boundary, while the caller may pass an address below lowmem, which will
      trigger an oops:
      
        # echo scan > /sys/kernel/debug/kmemleak
        Unable to handle kernel paging request at virtual address ff5fffffffe00000
        Oops [#1]
        Modules linked in:
        CPU: 2 PID: 134 Comm: bash Not tainted 5.18.0-rc1-next-20220407 #33
        Hardware name: riscv-virtio,qemu (DT)
        epc : scan_block+0x74/0x15c
         ra : scan_block+0x72/0x15c
        epc : ffffffff801e5806 ra : ffffffff801e5804 sp : ff200000104abc30
         gp : ffffffff815cd4e8 tp : ff60000004cfa340 t0 : 0000000000000200
         t1 : 00aaaaaac23954cc t2 : 00000000000003ff s0 : ff200000104abc90
         s1 : ffffffff81b0ff28 a0 : 0000000000000000 a1 : ff5fffffffe01000
         a2 : ffffffff81b0ff28 a3 : 0000000000000002 a4 : 0000000000000001
         a5 : 0000000000000000 a6 : ff200000104abd7c a7 : 0000000000000005
         s2 : ff5fffffffe00ff9 s3 : ffffffff815cd998 s4 : ffffffff815d0e90
         s5 : ffffffff81b0ff28 s6 : 0000000000000020 s7 : ffffffff815d0eb0
         s8 : ffffffffffffffff s9 : ff5fffffffe00000 s10: ff5fffffffe01000
         s11: 0000000000000022 t3 : 00ffffffaa17db4c t4 : 000000000000000f
         t5 : 0000000000000001 t6 : 0000000000000000
        status: 0000000000000100 badaddr: ff5fffffffe00000 cause: 000000000000000d
          scan_gray_list+0x12e/0x1a6
          kmemleak_scan+0x2aa/0x57e
          kmemleak_write+0x32a/0x40c
          full_proxy_write+0x56/0x82
          vfs_write+0xa6/0x2a6
          ksys_write+0x6c/0xe2
          sys_write+0x22/0x2a
          ret_from_syscall+0x0/0x2
      
      The callers may not quite know the actual address they pass(e.g. from
      devicetree).  So the kmemleak_*_phys() apis should guarantee the address
      they finally use is in lowmem range, so check the address for lowmem's
      min boundary.
      
      Link: https://lkml.kernel.org/r/20220413122925.33856-1-patrick.wang.shcn@gmail.com
      Signed-off-by: default avatarPatrick Wang <patrick.wang.shcn@gmail.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      23c2d497
    • Omar Sandoval's avatar
      mm/vmalloc: fix spinning drain_vmap_work after reading from /proc/vmcore · c12cd77c
      Omar Sandoval authored
      Commit 3ee48b6a ("mm, x86: Saving vmcore with non-lazy freeing of
      vmas") introduced set_iounmap_nonlazy(), which sets vmap_lazy_nr to
      lazy_max_pages() + 1, ensuring that any future vunmaps() immediately
      purge the vmap areas instead of doing it lazily.
      
      Commit 690467c8 ("mm/vmalloc: Move draining areas out of caller
      context") moved the purging from the vunmap() caller to a worker thread.
      Unfortunately, set_iounmap_nonlazy() can cause the worker thread to spin
      (possibly forever).  For example, consider the following scenario:
      
       1. Thread reads from /proc/vmcore. This eventually calls
          __copy_oldmem_page() -> set_iounmap_nonlazy(), which sets
          vmap_lazy_nr to lazy_max_pages() + 1.
      
       2. Then it calls free_vmap_area_noflush() (via iounmap()), which adds 2
          pages (one page plus the guard page) to the purge list and
          vmap_lazy_nr. vmap_lazy_nr is now lazy_max_pages() + 3, so the
          drain_vmap_work is scheduled.
      
       3. Thread returns from the kernel and is scheduled out.
      
       4. Worker thread is scheduled in and calls drain_vmap_area_work(). It
          frees the 2 pages on the purge list. vmap_lazy_nr is now
          lazy_max_pages() + 1.
      
       5. This is still over the threshold, so it tries to purge areas again,
          but doesn't find anything.
      
       6. Repeat 5.
      
      If the system is running with only one CPU (which is typicial for kdump)
      and preemption is disabled, then this will never make forward progress:
      there aren't any more pages to purge, so it hangs.  If there is more
      than one CPU or preemption is enabled, then the worker thread will spin
      forever in the background.  (Note that if there were already pages to be
      purged at the time that set_iounmap_nonlazy() was called, this bug is
      avoided.)
      
      This can be reproduced with anything that reads from /proc/vmcore
      multiple times.  E.g., vmcore-dmesg /proc/vmcore.
      
      It turns out that improvements to vmap() over the years have obsoleted
      the need for this "optimization".  I benchmarked `dd if=/proc/vmcore
      of=/dev/null` with 4k and 1M read sizes on a system with a 32GB vmcore.
      The test was run on 5.17, 5.18-rc1 with a fix that avoided the hang, and
      5.18-rc1 with set_iounmap_nonlazy() removed entirely:
      
          |5.17  |5.18+fix|5.18+removal
        4k|40.86s|  40.09s|      26.73s
        1M|24.47s|  23.98s|      21.84s
      
      The removal was the fastest (by a wide margin with 4k reads).  This
      patch removes set_iounmap_nonlazy().
      
      Link: https://lkml.kernel.org/r/52f819991051f9b865e9ce25605509bfdbacadcd.1649277321.git.osandov@fb.com
      Fixes: 690467c8
      
        ("mm/vmalloc: Move draining areas out of caller context")
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Acked-by: default avatarChris Down <chris@chrisdown.name>
      Reviewed-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: default avatarBaoquan He <bhe@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c12cd77c
    • Andrew Morton's avatar
      revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE" · aeb79237
      Andrew Morton authored
      Despite Mike's attempted fix (925346c1), regressions reports
      continue:
      
        https://lore.kernel.org/lkml/cb5b81bd-9882-e5dc-cd22-54bdbaaefbbc@leemhuis.info/
        https://bugzilla.kernel.org/show_bug.cgi?id=215720
        https://lkml.kernel.org/r/b685f3d0-da34-531d-1aa9-479accd3e21b@leemhuis.info
      
      So revert this patch.
      
      Fixes: 9630f0d6
      
       ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE")
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Chris Kennelly <ckennelly@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: H.J. Lu <hjl.tools@gmail.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Sandeep Patil <sspatil@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Thorsten Leemhuis <regressions@leemhuis.info>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      aeb79237
    • Andrew Morton's avatar
      revert "fs/binfmt_elf: fix PT_LOAD p_align values for loaders" · 354e923d
      Andrew Morton authored
      Commit 925346c1 ("fs/binfmt_elf: fix PT_LOAD p_align values for
      loaders") was an attempt to fix regressions due to 9630f0d6
      ("fs/binfmt_elf: use PT_LOAD p_align values for static PIE").
      
      But regressionss continue to be reported:
      
        https://lore.kernel.org/lkml/cb5b81bd-9882-e5dc-cd22-54bdbaaefbbc@leemhuis.info/
        https://bugzilla.kernel.org/show_bug.cgi?id=215720
        https://lkml.kernel.org/r/b685f3d0-da34-531d-1aa9-479accd3e21b@leemhuis.info
      
      This patch reverts the fix, so the original can also be reverted.
      
      Fixes: 925346c1
      
       ("fs/binfmt_elf: fix PT_LOAD p_align values for loaders")
      Cc: H.J. Lu <hjl.tools@gmail.com>
      Cc: Chris Kennelly <ckennelly@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Sandeep Patil <sspatil@google.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thorsten Leemhuis <regressions@leemhuis.info>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      354e923d
    • Mike Kravetz's avatar
      hugetlb: do not demote poisoned hugetlb pages · 5a317412
      Mike Kravetz authored
      It is possible for poisoned hugetlb pages to reside on the free lists.
      The huge page allocation routines which dequeue entries from the free
      lists make a point of avoiding poisoned pages.  There is no such check
      and avoidance in the demote code path.
      
      If a hugetlb page on the is on a free list, poison will only be set in
      the head page rather then the page with the actual error.  If such a
      page is demoted, then the poison flag may follow the wrong page.  A page
      without error could have poison set, and a page with poison could not
      have the flag set.
      
      Check for poison before attempting to demote a hugetlb page.  Also,
      return -EBUSY to the caller if only poisoned pages are on the free list.
      
      Link: https://lkml.kernel.org/r/20220307215707.50916-1-mike.kravetz@oracle.com
      Fixes: 8531fc6f
      
       ("hugetlb: add hugetlb demote page support")
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Reviewed-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5a317412