1. May 09, 2022
    • Brian Norris's avatar
      soc: rockchip: power-domain: Manage resource conflicts with firmware · defec178
      Brian Norris authored
      On RK3399 platforms, power domains are managed mostly by the kernel
      (drivers/soc/rockchip/pm_domains.c), but there are a few exceptions
      where ARM Trusted Firmware has to be involved:
      
      (1) system suspend/resume
      (2) DRAM DVFS (a.k.a., "ddrfreq")
      
      Exception (1) does not cause much conflict, since the kernel has
      quiesced itself by the time we make the relevant PSCI call.
      
      Exception (2) can cause conflict, because of two actions:
      
      (a) ARM Trusted Firmware needs to read/modify/write the PMU_BUS_IDLE_REQ
          register to idle the memory controller domain; the kernel driver
          also has to touch this register for other domains.
      (b) ARM Trusted Firmware needs to manage the clocks associated with
          these domains.
      
      To elaborate on (b): idling a power domain has always required ungating
      an array of clocks; see this old explanation from Rockchip:
      https://lore.kernel.org/linux-arm-kernel/54503C19.9060607@rock-chips.com/
      
      Historically, ARM Trusted Firmware has avoided this issue by using a
      special PMU_CRU_GATEDIS_CON0 register -- this register ungates all the
      necessary clocks -- when idling the memory controller. Unfortunately,
      we've found that this register is not 100% sufficient; it does not turn
      the relevant PLLs on [0].
      
      So it's possible to trigger issues with something like the following:
      
      1. enable a power domain (e.g., RK3399_PD_VDU) -- kernel will
         temporarily enable relevant clocks/PLLs, then turn them back off
         2. a PLL (e.g., PLL_NPLL) is part of the clock tree for
            RK3399_PD_VDU's clocks but otherwise unused; NPLL is disabled
      3. perform a ddrfreq transition (rk3399_dmcfreq_target() -> ...
         drivers/clk/rockchip/clk-ddr.c / ROCKCHIP_SIP_DRAM_FREQ)
         4. ARM Trusted Firmware unagates VDU clocks (via PMU_CRU_GATEDIS_CON0)
         5. ARM Trusted firmware idles the memory controller domain
         6. Step 5 waits on the VDU domain/clocks, but NPLL is still off
      
      i.e., we hang the system.
      
      So for (b), we need to at a minimum manage the relevant PLLs on behalf
      of firmware. It's easier to simply manage the whole clock tree, in a
      similar way we do in rockchip_pd_power().
      
      For (a), we need to provide mutual exclusion betwen rockchip_pd_power()
      and firmware. To resolve that, we simply grab the PMU mutex and release
      it when ddrfreq is done.
      
      The Chromium OS kernel has been carrying versions of part of this hack
      for a while, based on some new custom notifiers [1]. I've rewritten as a
      simple function call between the drivers, which is OK because:
      
       * the PMU driver isn't enabled, and we don't have this problem at all
         (the firmware should have left us in an OK state, and there are no
         runtime conflicts); or
       * the PMU driver is present, and is a single instance.
      
      And the power-domain driver cannot be removed, so there's no lifetime
      management to worry about.
      
      For completeness, there's a 'dmc_pmu_mutex' to guard (likely
      theoretical?) probe()-time races. It's OK for the memory controller
      driver to start running before the PMU, because the PMU will avoid any
      critical actions during the block() sequence.
      
      [0] The RK3399 TRM for PMU_CRU_GATEDIS_CON0 only talks about ungating
          clocks. Based on experimentation, we've found that it does not power
          up the necessary PLLs.
      
      [1] CHROMIUM: soc: rockchip: power-domain: Add notifier to dmc driver
          https://chromium-review.googlesource.com/q/I242dbd706d352f74ff706f5cbf42ebb92f9bcc60
      
      
          Notably, the Chromium solution only handled conflict (a), not (b).
          In practice, item (b) wasn't a problem in many cases because we
          never managed to fully power off PLLs. Now that the (upstream) video
          decoder driver performs runtime clock management, we often power off
          NPLL.
      
      Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
      Tested-by: default avatarPeter Geis <pgwipeout@gmail.com>
      Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      defec178
  2. Apr 14, 2022
  3. Apr 04, 2022
    • Linus Torvalds's avatar
      Linux 5.18-rc1 · 31231092
      Linus Torvalds authored
      31231092
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 09bb8856
      Linus Torvalds authored
      Pull more tracing updates from Steven Rostedt:
      
       - Rename the staging files to give them some meaning. Just
         stage1,stag2,etc, does not show what they are for
      
       - Check for NULL from allocation in bootconfig
      
       - Hold event mutex for dyn_event call in user events
      
       - Mark user events to broken (to work on the API)
      
       - Remove eBPF updates from user events
      
       - Remove user events from uapi header to keep it from being installed.
      
       - Move ftrace_graph_is_dead() into inline as it is called from hot
         paths and also convert it into a static branch.
      
      * tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Move user_events.h temporarily out of include/uapi
        ftrace: Make ftrace_graph_is_dead() a static branch
        tracing: Set user_events to BROKEN
        tracing/user_events: Remove eBPF interfaces
        tracing/user_events: Hold event_mutex during dyn_event_add
        proc: bootconfig: Add null pointer check
        tracing: Rename the staging files for trace_events
      09bb8856
    • Linus Torvalds's avatar
      Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 34a53ff9
      Linus Torvalds authored
      Pull clk fix from Stephen Boyd:
       "A single revert to fix a boot regression seen when clk_put() started
        dropping rate range requests. It's best to keep various systems
        booting so we'll kick this out and try again next time"
      
      * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        Revert "clk: Drop the rate range on clk_put()"
      34a53ff9
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8b5656bc
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of x86 fixes and updates:
      
         - Make the prctl() for enabling dynamic XSTATE components correct so
           it adds the newly requested feature to the permission bitmap
           instead of overwriting it. Add a selftest which validates that.
      
         - Unroll string MMIO for encrypted SEV guests as the hypervisor
           cannot emulate it.
      
         - Handle supervisor states correctly in the FPU/XSTATE code so it
           takes the feature set of the fpstate buffer into account. The
           feature sets can differ between host and guest buffers. Guest
           buffers do not contain supervisor states. So far this was not an
           issue, but with enabling PASID it needs to be handled in the buffer
           offset calculation and in the permission bitmaps.
      
         - Avoid a gazillion of repeated CPUID invocations in by caching the
           values early in the FPU/XSTATE code.
      
         - Enable CONFIG_WERROR in x86 defconfig.
      
         - Make the X86 defconfigs more useful by adapting them to Y2022
           reality"
      
      * tag 'x86-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/fpu/xstate: Consolidate size calculations
        x86/fpu/xstate: Handle supervisor states in XSTATE permissions
        x86/fpu/xsave: Handle compacted offsets correctly with supervisor states
        x86/fpu: Cache xfeature flags from CPUID
        x86/fpu/xsave: Initialize offset/size cache early
        x86/fpu: Remove unused supervisor only offsets
        x86/fpu: Remove redundant XCOMP_BV initialization
        x86/sev: Unroll string mmio with CC_ATTR_GUEST_UNROLL_STRING_IO
        x86/config: Make the x86 defconfigs a bit more usable
        x86/defconfig: Enable WERROR
        selftests/x86/amx: Update the ARCH_REQ_XCOMP_PERM test
        x86/fpu/xstate: Fix the ARCH_REQ_XCOMP_PERM implementation
      8b5656bc
    • Linus Torvalds's avatar
      Merge tag 'core-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e235f419
      Linus Torvalds authored
      Pull RT signal fix from Thomas Gleixner:
       "Revert the RT related signal changes. They need to be reworked and
        generalized"
      
      * tag 'core-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        Revert "signal, x86: Delay calling signals in atomic on RT enabled kernels"
      e235f419
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping · 63d12cc3
      Linus Torvalds authored
      Pull more dma-mapping updates from Christoph Hellwig:
      
       - fix a regression in dma remap handling vs AMD memory encryption (me)
      
       - finally kill off the legacy PCI DMA API (Christophe JAILLET)
      
      * tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping:
        dma-mapping: move pgprot_decrypted out of dma_pgprot
        PCI/doc: cleanup references to the legacy PCI DMA API
        PCI: Remove the deprecated "pci-dma-compat.h" API
      63d12cc3
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 5dee8721
      Linus Torvalds authored
      Pull ARM fixes from Russell King:
      
       - avoid unnecessary rebuilds for library objects
      
       - fix return value of __setup handlers
      
       - fix invalid input check for "crashkernel=" kernel option
      
       - silence KASAN warnings in unwind_frame
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame()
        ARM: 9190/1: kdump: add invalid input check for 'crashkernel=0'
        ARM: 9187/1: JIVE: fix return value of __setup handler
        ARM: 9189/1: decompressor: fix unneeded rebuilds of library objects
      5dee8721
  4. Apr 03, 2022
  5. Apr 02, 2022