Skip to content
  1. Oct 15, 2021
    • Michael Ellerman's avatar
      KVM: PPC: Book3S HV: Make idle_kvm_start_guest() return 0 if it went to guest · cdeb5d7d
      Michael Ellerman authored
      We call idle_kvm_start_guest() from power7_offline() if the thread has
      been requested to enter KVM. We pass it the SRR1 value that was returned
      from power7_idle_insn() which tells us what sort of wakeup we're
      processing.
      
      Depending on the SRR1 value we pass in, the KVM code might enter the
      guest, or it might return to us to do some host action if the wakeup
      requires it.
      
      If idle_kvm_start_guest() is able to handle the wakeup, and enter the
      guest it is supposed to indicate that by returning a zero SRR1 value to
      us.
      
      That was the behaviour prior to commit 10d91611 ("powerpc/64s:
      Reimplement book3s idle code in C"), however in that commit the
      handling of SRR1 was reworked, and the zeroing behaviour was lost.
      
      Returning from idle_kvm_start_guest() without zeroing the SRR1 value can
      confuse the host offline code, causing the guest to crash and other
      weirdness.
      
      Fixes: 10d91611
      
       ("powerpc/64s: Reimplement book3s idle code in C")
      Cc: stable@vger.kernel.org # v5.2+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20211015133929.832061-2-mpe@ellerman.id.au
      cdeb5d7d
    • Michael Ellerman's avatar
      KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest() · 9b4416c5
      Michael Ellerman authored
      In commit 10d91611 ("powerpc/64s: Reimplement book3s idle code in
      C") kvm_start_guest() became idle_kvm_start_guest(). The old code
      allocated a stack frame on the emergency stack, but didn't use the
      frame to store anything, and also didn't store anything in its caller's
      frame.
      
      idle_kvm_start_guest() on the other hand is written more like a normal C
      function, it creates a frame on entry, and also stores CR/LR into its
      callers frame (per the ABI). The problem is that there is no caller
      frame on the emergency stack.
      
      The emergency stack for a given CPU is allocated with:
      
        paca_ptrs[i]->emergency_sp = alloc_stack(limit, i) + THREAD_SIZE;
      
      So emergency_sp actually points to the first address above the emergency
      stack allocation for a given CPU, we must not store above it without
      first decrementing it to create a frame. This is different to the
      regular kernel stack, paca->kstack, which is initialised to point at an
      initial frame that is ready to use.
      
      idle_kvm_start_guest() stores the backchain, CR and LR all of which
      write outside the allocation for the emergency stack. It then creates a
      stack frame and saves the non-volatile registers. Unfortunately the
      frame it creates is not large enough to fit the non-volatiles, and so
      the saving of the non-volatile registers also writes outside the
      emergency stack allocation.
      
      The end result is that we corrupt whatever is at 0-24 bytes, and 112-248
      bytes above the emergency stack allocation.
      
      In practice this has gone unnoticed because the memory immediately above
      the emergency stack happens to be used for other stack allocations,
      either another CPUs mc_emergency_sp or an IRQ stack. See the order of
      calls to irqstack_early_init() and emergency_stack_init().
      
      The low addresses of another stack are the top of that stack, and so are
      only used if that stack is under extreme pressue, which essentially
      never happens in practice - and if it did there's a high likelyhood we'd
      crash due to that stack overflowing.
      
      Still, we shouldn't be corrupting someone else's stack, and it is purely
      luck that we aren't corrupting something else.
      
      To fix it we save CR/LR into the caller's frame using the existing r1 on
      entry, we then create a SWITCH_FRAME_SIZE frame (which has space for
      pt_regs) on the emergency stack with the backchain pointing to the
      existing stack, and then finally we switch to the new frame on the
      emergency stack.
      
      Fixes: 10d91611
      
       ("powerpc/64s: Reimplement book3s idle code in C")
      Cc: stable@vger.kernel.org # v5.2+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20211015133929.832061-1-mpe@ellerman.id.au
      9b4416c5
  2. Oct 13, 2021
  3. Oct 07, 2021
  4. Sep 30, 2021
  5. Sep 20, 2021
    • Linus Torvalds's avatar
      Linux 5.15-rc2 · e4e737bb
      Linus Torvalds authored
      e4e737bb
    • Linus Torvalds's avatar
      pci_iounmap'2: Electric Boogaloo: try to make sense of it all · 316e8d79
      Linus Torvalds authored
      Nathan Chancellor reports that the recent change to pci_iounmap in
      commit 9caea000 ("parisc: Declare pci_iounmap() parisc version only
      when CONFIG_PCI enabled") causes build errors on arm64.
      
      It took me about two hours to convince myself that I think I know what
      the logic of that mess of #ifdef's in the <asm-generic/io.h> header file
      really aim to do, and rewrite it to be easier to follow.
      
      Famous last words.
      
      Anyway, the code has now been lifted from that grotty header file into
      lib/pci_iomap.c, and has fairly extensive comments about what the logic
      is.  It also avoids indirecting through another confusing (and badly
      named) helper function that has other preprocessor config conditionals.
      
      Let's see what odd architecture did something else strange in this area
      to break things.  But my arm64 cross build is clean.
      
      Fixes: 9caea000
      
       ("parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled")
      Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
      Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      316e8d79
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.15_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 20621d2f
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - Prevent a infinite loop in the MCE recovery on return to user space,
         which was caused by a second MCE queueing work for the same page and
         thereby creating a circular work list.
      
       - Make kern_addr_valid() handle existing PMD entries, which are marked
         not present in the higher level page table, correctly instead of
         blindly dereferencing them.
      
       - Pass a valid address to sanitize_phys(). This was caused by the
         mixture of inclusive and exclusive ranges. memtype_reserve() expect
         'end' being exclusive, but sanitize_phys() wants it inclusive. This
         worked so far, but with end being the end of the physical address
         space the fail is exposed.
      
       - Increase the maximum supported GPIO numbers for 64bit. Newer SoCs
         exceed the previous maximum.
      
      * tag 'x86_urgent_for_v5.15_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mce: Avoid infinite loop for copy from user recovery
        x86/mm: Fix kern_addr_valid() to cope with existing but not present entries
        x86/platform: Increase maximum GPIO number for X86_64
        x86/pat: Pass valid address to sanitize_phys()
      20621d2f
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · fec30362
      Linus Torvalds authored
      Pull perf event fix from Thomas Gleixner:
       "A single fix for the perf core where a value read with READ_ONCE() was
        checked and then reread which makes all the checks invalid. Reuse the
        already read value instead"
      
      * tag 'perf-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        events: Reuse value read using READ_ONCE instead of re-reading it
      fec30362
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f5e29a26
      Linus Torvalds authored
      Pull locking fixes from Thomas Gleixner:
       "A set of updates for the RT specific reader/writer locking base code:
      
         - Make the fast path reader ordering guarantees correct.
      
         - Code reshuffling to make the fix simpler"
      
      [ This plays ugly games with atomic_add_return_release() because we
        don't have a plain atomic_add_release(), and should really be cleaned
        up, I think    - Linus ]
      
      * tag 'locking-urgent-2021-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rwbase: Take care of ordering guarantee for fastpath reader
        locking/rwbase: Extract __rwbase_write_trylock()
        locking/rwbase: Properly match set_and_save_state() to restore_state()
      f5e29a26
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 62453a46
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix crashes when scv (System Call Vectored) is used to make a syscall
         when a transaction is active, on Power9 or later.
      
       - Fix bad interactions between rfscv (Return-from scv) and Power9
         fake-suspend mode.
      
       - Fix crashes when handling machine checks in LPARs using the Hash MMU.
      
       - Partly revert a recent change to our XICS interrupt controller code,
         which broke the recently added Microwatt support.
      
      Thanks to Cédric Le Goater, Eirik Fuller, Ganesh Goudar, Gustavo Romero,
      Joel Stanley, Nicholas Piggin.
      
      * tag 'powerpc-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/xics: Set the IRQ chip data for the ICS native backend
        powerpc/mce: Fix access error in mce handler
        KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers
        powerpc/64s: system call rfscv workaround for TM bugs
        selftests/powerpc: Add scv versions of the basic TM syscall tests
        powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state
      62453a46
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.15' of... · 2f629969
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Fix bugs in checkkconfigsymbols.py
      
       - Fix missing sys import in gen_compile_commands.py
      
       - Fix missing FORCE warning for ARCH=sh builds
      
       - Fix -Wignored-optimization-argument warnings for Clang builds
      
       - Turn -Wignored-optimization-argument into an error in order to stop
         building instead of sprinkling warnings
      
      * tag 'kbuild-fixes-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS
        x86/build: Do not add -falign flags unconditionally for clang
        kbuild: Fix comment typo in scripts/Makefile.modpost
        sh: Add missing FORCE prerequisites in Makefile
        gen_compile_commands: fix missing 'sys' package
        checkkconfigsymbols.py: Remove skipping of help lines in parse_kconfig_file
        checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit
      2f629969
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.15-2021-09-18' of... · d94f3957
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.15-2021-09-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix ip display in 'perf script' when output type != attr->type.
      
       - Ignore deprecation warning when using libbpf'sg btf__get_from_id(),
         fixing the build with libbpf v0.6+.
      
       - Make use of FD() robust in libperf, fixing a segfault with 'perf stat
         --iostat list'.
      
       - Initialize addr_location:srcline pointer to NULL when resolving
         callchain addresses.
      
       - Fix fused instruction logic for assembly functions in 'perf
         annotate'.
      
      * tag 'perf-tools-fixes-for-v5.15-2021-09-18' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf bpf: Ignore deprecation warning when using libbpf's btf__get_from_id()
        libperf evsel: Make use of FD robust.
        perf machine: Initialize srcline string member in add_location struct
        perf script: Fix ip display when type != attr->type
        perf annotate: Fix fused instr logic for assembly functions
      d94f3957
    • Linus Torvalds's avatar
      dmascc: use proper 'virt_to_bus()' rather than casting to 'int' · bc1abb9e
      Linus Torvalds authored
      
      
      The old dmascc driver depends on the legacy ISA_DMA_API, and blindly
      just casts the kernel virtual address to 'int' for set_dma_addr().
      
      That works only incidentally, and because the high bits of the address
      will be ignored anyway. And on 64-bit architectures it causes warnings.
      
      Admittedly, 64-bit architectures with ISA are basically dead - I think
      the only example of this is alpha, and nobody would ever use the dmascc
      driver there.  But hey, the fix is easy enough, the end result is
      cleaner, and it's yet another configuration that now builds without
      warnings.
      
      If somebody actually uses this driver on an alpha and this fixes it for
      you, please email me.  Because that is just incredibly bizarre.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bc1abb9e
    • Linus Torvalds's avatar
      alpha: enable GENERIC_PCI_IOMAP unconditionally · 4fef6115
      Linus Torvalds authored
      With the previous commit (9caea000
      
      : "parisc: Declare pci_iounmap()
      parisc version only when CONFIG_PCI enabled") we can now enable
      GENERIC_PCI_IOMAP unconditionally on alpha, and if PCI is not enabled we
      will just get the nice empty helper functions that allow mixed-bus
      drivers to build.
      
      Example driver: the old 3com/3c59x.c driver works with either the PCI or
      the EISA version of the 3x59x card, but wouldn't build in an EISA-only
      configuration because of missing pci_iomap() and pci_iounmap() dummy
      wrappers.
      
      Most of the other PCI infrastructure just becomes empty wrappers even
      without GENERIC_PCI_IOMAP, and it's not obvious that the pci_iomap
      functionality shouldn't do the same, but this works.
      
      Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4fef6115
    • Helge Deller's avatar
      parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled · 9caea000
      Helge Deller authored
      Linus noticed odd declaration rules for pci_iounmap() in iomap.h and
      pci_iomap.h, where it dependend on either NO_GENERIC_PCI_IOPORT_MAP or
      GENERIC_IOMAP when CONFIG_PCI was disabled.
      
      Testing on parisc seems to indicate that we need pci_iounmap() only when
      CONFIG_PCI is enabled, so the declaration of pci_iounmap() can be moved
      cleanly into pci_iomap.h in sync with the declarations of pci_iomap().
      
      Link: https://lore.kernel.org/all/CAHk-=wjRrh98pZoQ+AzfWmsTZacWxTJKXZ9eKU2X_0+jM=O8nw@mail.gmail.com/
      
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Fixes: 97a29d59
      
       ("[PARISC] fix compile break caused by iomap: make IOPORT/PCI mapping functions conditional")
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Ulrich Teichert <krypton@ulrich-teichert.org>
      Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9caea000
    • Linus Torvalds's avatar
      Revert "drm/vc4: hdmi: Remove drm_encoder->crtc usage" · 31ad37bd
      Linus Torvalds authored
      This reverts commit 27da370e.
      
      Sudip Mukherjee reports that this broke pulseaudio with a NULL pointer
      dereference in vc4_hdmi_audio_prepare(), bisected it to this commit, and
      confirmed that a revert fixed the problem.
      
      Revert the problematic commit until fixed.
      
      Link: https://lore.kernel.org/all/CADVatmPB9-oKd=ypvj25UYysVo6EZhQ6bCM7EvztQBMyiZfAyw@mail.gmail.com/
      Link: https://lore.kernel.org/all/CADVatmN5EpRshGEPS_JozbFQRXg5w_8LFB3OMP1Ai-ghxd3w4g@mail.gmail.com/
      
      
      Reported-and-tested-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Cc: Maxime Ripard <maxime@cerno.tech>
      Cc: Emma Anholt <emma@anholt.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      31ad37bd
    • Linus Torvalds's avatar
      Revert drm/vc4 hdmi runtime PM changes · b1044a9b
      Linus Torvalds authored
      This reverts commits
      
        9984d666 ("drm/vc4: hdmi: Make sure the controller is powered in detect")
        411efa18 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm")
      
      as Michael Stapelberg reports that the new runtime PM changes cause his
      Raspberry Pi 3 to hang on boot, probably due to interactions with other
      changes in the DRM tree (because a bisect points to the merge in commit
      e058a84b: "Merge tag 'drm-next-2021-07-01' of git://.../drm").
      
      Revert these two commits until it's been resolved.
      
      Link: https://lore.kernel.org/all/871r5mp7h2.fsf@midna.i-did-not-set--mail-host-address--so-tickle-me/
      
      
      Reported-and-tested-by: default avatarMichael Stapelberg <michael@stapelberg.ch>
      Cc: Maxime Ripard <maxime@cerno.tech>
      Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
      Cc: Dave Airlie <airlied@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1044a9b
  6. Sep 19, 2021