Skip to content
  1. Dec 14, 2023
    • Ronald Wahl's avatar
      serial: 8250_omap: Add earlycon support for the AM654 UART controller · 22fdcaaf
      Ronald Wahl authored
      commit 8e42c301
      
       upstream.
      
      Currently there is no support for earlycon on the AM654 UART
      controller. This commit adds it.
      
      Signed-off-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
      Reviewed-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
      Link: https://lore.kernel.org/r/20231031131242.15516-1-rwahl@gmx.de
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22fdcaaf
    • Ronald Wahl's avatar
      serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt · a2c0b05a
      Ronald Wahl authored
      commit c6bb0574 upstream.
      
      Starting RX DMA on THRI interrupt is too early because TX may not have
      finished yet.
      
      This change is inspired by commit 90b8596a ("serial: 8250: Prevent
      starting up DMA Rx on THRI interrupt") and fixes DMA issues I had with
      an AM62 SoC that is using the 8250 OMAP variant.
      
      Cc: stable@vger.kernel.org
      Fixes: c26389f9
      
       ("serial: 8250: 8250_omap: Add DMA support for UARTs on K3 SoCs")
      Signed-off-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
      Reviewed-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
      Link: https://lore.kernel.org/r/20231101171431.16495-1-rwahl@gmx.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2c0b05a
    • Ronald Wahl's avatar
      serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit · 70dc9a48
      Ronald Wahl authored
      commit 8973ab7a upstream.
      
      This fixes commit 439c7183 ("serial: 8250: 8250_omap: Disable RX
      interrupt after DMA enable") which unfortunately set the
      UART_HAS_RHR_IT_DIS bit in the UART_OMAP_IER2 register and never
      cleared it.
      
      Cc: stable@vger.kernel.org
      Fixes: 439c7183
      
       ("serial: 8250: 8250_omap: Disable RX interrupt after DMA enable")
      Signed-off-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
      Reviewed-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
      Link: https://lore.kernel.org/r/20231031110909.11695-1-rwahl@gmx.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70dc9a48
    • Daniel Mack's avatar
      serial: sc16is7xx: address RX timeout interrupt errata · 98b0ca90
      Daniel Mack authored
      commit 08ce9a1b
      
       upstream.
      
      This device has a silicon bug that makes it report a timeout interrupt
      but no data in the FIFO.
      
      The datasheet states the following in the errata section 18.1.4:
      
        "If the host reads the receive FIFO at the same time as a
        time-out interrupt condition happens, the host might read 0xCC
        (time-out) in the Interrupt Indication Register (IIR), but bit 0
        of the Line Status Register (LSR) is not set (means there is no
        data in the receive FIFO)."
      
      The errata description seems to indicate it concerns only polled mode of
      operation when reading bit 0 of the LSR register. However, tests have
      shown and NXP has confirmed that the RXLVL register also yields 0 when
      the bug is triggered, and hence the IRQ driven implementation in this
      driver is equally affected.
      
      This bug has hit us on production units and when it does, sc16is7xx_irq()
      would spin forever because sc16is7xx_port_irq() keeps seeing an
      interrupt in the IIR register that is not cleared because the driver
      does not call into sc16is7xx_handle_rx() unless the RXLVL register
      reports at least one byte in the FIFO.
      
      Fix this by always reading one byte from the FIFO when this condition
      is detected in order to clear the interrupt. This approach was
      confirmed to be correct by NXP through their support channels.
      
      Tested by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
      
      Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
      Co-Developed-by: default avatarMaxim Popov <maxim.snafu@gmail.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20231123072818.1394539-1-daniel@zonque.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98b0ca90
    • Arnd Bergmann's avatar
      ARM: PL011: Fix DMA support · c865b77e
      Arnd Bergmann authored
      commit 58ac1b37 upstream.
      
      Since there is no guarantee that the memory returned by
      dma_alloc_coherent() is associated with a 'struct page', using the
      architecture specific phys_to_page() is wrong, but using
      virt_to_page() would be as well.
      
      Stop using sg lists altogether and just use the *_single() functions
      instead. This also simplifies the code a bit since the scatterlists in
      this driver always have only one entry anyway.
      
      https://lore.kernel.org/lkml/86db0fe5-930d-4cbb-bd7d-03367da38951@app.fastmail.com/
          Use consistent names for dma buffers
      
      gc: Add a commit log from the initial thread:
      https://lore.kernel.org/lkml/86db0fe5-930d-4cbb-bd7d-03367da38951@app.fastmail.com/
          Use consistent names for dma buffers
      
      Fixes: cb06ff10
      
       ("ARM: PL011: Add support for Rx DMA buffer polling.")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Tested-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20231122171503.235649-1-gregory.clement@bootlin.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c865b77e
    • RD Babiera's avatar
      usb: typec: class: fix typec_altmode_put_partner to put plugs · 2214c3f4
      RD Babiera authored
      commit b17b7fe6 upstream.
      
      When typec_altmode_put_partner is called by a plug altmode upon release,
      the port altmode the plug belongs to will not remove its reference to the
      plug. The check to see if the altmode being released evaluates against the
      released altmode's partner instead of the calling altmode itself, so change
      adev in typec_altmode_put_partner to properly refer to the altmode being
      released.
      
      typec_altmode_set_partner is not run for port altmodes, so also add a check
      in typec_altmode_release to prevent typec_altmode_put_partner() calls on
      port altmode release.
      
      Fixes: 8a37d87d
      
       ("usb: typec: Bus type for alternate modes")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRD Babiera <rdbabiera@google.com>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Link: https://lore.kernel.org/r/20231129192349.1773623-2-rdbabiera@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2214c3f4
    • Paulo Alcantara's avatar
      smb: client: fix potential NULL deref in parse_dfs_referrals() · 5ac34ba4
      Paulo Alcantara authored
      commit 92414333 upstream.
      
      If server returned no data for FSCTL_DFS_GET_REFERRALS, @dfs_rsp will
      remain NULL and then parse_dfs_referrals() will dereference it.
      
      Fix this by returning -EIO when no output data is returned.
      
      Besides, we can't fix it in SMB2_ioctl() as some FSCTLs are allowed to
      return no data as per MS-SMB2 2.2.32.
      
      Fixes: 9d49640a
      
       ("CIFS: implement get_dfs_refer for SMB2+")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ac34ba4
    • Mathias Nyman's avatar
      Revert "xhci: Loosen RPM as default policy to cover for AMD xHC 1.1" · 05668be6
      Mathias Nyman authored
      commit 24be0b3c upstream.
      
      This reverts commit 4baf1218.
      
      Enabling runtime pm as default for all AMD xHC 1.1 controllers caused
      regression. An initial attempt to fix those was done in commit a5d6264b
      ("xhci: Enable RPM on controllers that support low-power states") but new
      issues are still seen.
      
      Revert this to get those AMD xHC 1.1 systems working
      
      This patch went to stable an needs to be reverted from there as well.
      
      Fixes: 4baf1218
      
       ("xhci: Loosen RPM as default policy to cover for AMD xHC 1.1")
      Link: https://lore.kernel.org/linux-usb/55c50bf5-bffb-454e-906e-4408c591cb63@molgen.mpg.de
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Cc: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Link: https://lore.kernel.org/r/20231205090548.1377667-1-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05668be6
    • David Howells's avatar
      cifs: Fix non-availability of dedup breaking generic/304 · 1bcb08e3
      David Howells authored
      commit 691a41d8 upstream.
      
      Deduplication isn't supported on cifs, but cifs doesn't reject it, instead
      treating it as extent duplication/cloning.  This can cause generic/304 to go
      silly and run for hours on end.
      
      Fix cifs to indicate EOPNOTSUPP if REMAP_FILE_DEDUP is set in
      ->remap_file_range().
      
      Note that it's unclear whether or not commit b073a080 is meant to cause
      cifs to return an error if REMAP_FILE_DEDUP.
      
      Fixes: b073a080
      
       ("cifs: fix that return -EINVAL when do dedupe operation")
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarDave Chinner <david@fromorbit.com>
      cc: Xiaoli Feng <fengxiaoli0714@gmail.com>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: Darrick Wong <darrick.wong@oracle.com>
      cc: fstests@vger.kernel.org
      cc: linux-cifs@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      Link: https://lore.kernel.org/r/3876191.1701555260@warthog.procyon.org.uk/
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bcb08e3
    • Cameron Williams's avatar
      parport: Add support for Brainboxes IX/UC/PX parallel cards · 67f45db9
      Cameron Williams authored
      commit 1a031f6e
      
       upstream.
      
      Adds support for Intashield IX-500/IX-550, UC-146/UC-157, PX-146/PX-157,
      PX-203 and PX-475 (LPT port)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarCameron Williams <cang1@live.co.uk>
      Acked-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Link: https://lore.kernel.org/r/AS4PR02MB790389C130410BD864C8DCC9C4A6A@AS4PR02MB7903.eurprd02.prod.outlook.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67f45db9
    • Andi Shyti's avatar
      serial: ma35d1: Validate console index before assignment · c88a91ca
      Andi Shyti authored
      commit f0b9d97a upstream.
      
      The console is immediately assigned to the ma35d1 port without
      checking its index. This oversight can lead to out-of-bounds
      errors when the index falls outside the valid '0' to
      MA35_UART_NR range. Such scenario trigges ran error like the
      following:
      
       UBSAN: array-index-out-of-bounds in drivers/tty/serial/ma35d1_serial.c:555:51
       index -1 is out of range for type 'uart_ma35d1_port [17]
      
      Check the index before using it and bail out with a warning.
      
      Fixes: 930cbf92
      
       ("tty: serial: Add Nuvoton ma35d1 serial driver support")
      Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
      Cc: Jacky Huang <ychuang3@nuvoton.com>
      Cc: <stable@vger.kernel.org> # v6.5+
      Link: https://lore.kernel.org/r/20231204163804.1331415-2-andi.shyti@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c88a91ca
    • Andy Shevchenko's avatar
      serial: 8250_dw: Add ACPI ID for Granite Rapids-D UART · 977a60f0
      Andy Shevchenko authored
      commit e92fad02
      
       upstream.
      
      Granite Rapids-D has an additional UART that is enumerated via ACPI.
      Add ACPI ID for it.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20231205195524.2705965-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      977a60f0
    • Miquel Raynal's avatar
      nvmem: Do not expect fixed layouts to grab a layout driver · a05c646d
      Miquel Raynal authored
      commit b7c1e537 upstream.
      
      Two series lived in parallel for some time, which led to this situation:
      - The nvmem-layout container is used for dynamic layouts
      - We now expect fixed layouts to also use the nvmem-layout container but
      this does not require any additional driver, the support is built-in the
      nvmem core.
      
      Ensure we don't refuse to probe for wrong reasons.
      
      Fixes: 27f699e5
      
       ("nvmem: core: add support for fixed cells *layout*")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Tested-by: default avatarRafał Miłecki <rafal@milecki.pl>
      Tested-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Reviewed-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Link: https://lore.kernel.org/r/20231124193814.360552-1-miquel.raynal@bootlin.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a05c646d
    • Konstantin Aladyshev's avatar
      usb: gadget: f_hid: fix report descriptor allocation · d9828961
      Konstantin Aladyshev authored
      commit 61890dc2 upstream.
      
      The commit 89ff3dfa ("usb: gadget: f_hid: fix f_hidg lifetime vs
      cdev") has introduced a bug that leads to hid device corruption after
      the replug operation.
      Reverse device managed memory allocation for the report descriptor
      to fix the issue.
      
      Tested:
      This change was tested on the AMD EthanolX CRB server with the BMC
      based on the OpenBMC distribution. The BMC provides KVM functionality
      via the USB gadget device:
      - before: KVM page refresh results in a broken USB device,
      - after: KVM page refresh works without any issues.
      
      Fixes: 89ff3dfa
      
       ("usb: gadget: f_hid: fix f_hidg lifetime vs cdev")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKonstantin Aladyshev <aladyshev22@gmail.com>
      Link: https://lore.kernel.org/r/20231206080744.253-2-aladyshev22@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9828961
    • JP Kobryn's avatar
      kprobes: consistent rcu api usage for kretprobe holder · 95a4c959
      JP Kobryn authored
      commit d839a656 upstream.
      
      It seems that the pointer-to-kretprobe "rp" within the kretprobe_holder is
      RCU-managed, based on the (non-rethook) implementation of get_kretprobe().
      The thought behind this patch is to make use of the RCU API where possible
      when accessing this pointer so that the needed barriers are always in place
      and to self-document the code.
      
      The __rcu annotation to "rp" allows for sparse RCU checking. Plain writes
      done to the "rp" pointer are changed to make use of the RCU macro for
      assignment. For the single read, the implementation of get_kretprobe()
      is simplified by making use of an RCU macro which accomplishes the same,
      but note that the log warning text will be more generic.
      
      I did find that there is a difference in assembly generated between the
      usage of the RCU macros vs without. For example, on arm64, when using
      rcu_assign_pointer(), the corresponding store instruction is a
      store-release (STLR) which has an implicit barrier. When normal assignment
      is done, a regular store (STR) is found. In the macro case, this seems to
      be a result of rcu_assign_pointer() using smp_store_release() when the
      value to write is not NULL.
      
      Link: https://lore.kernel.org/all/20231122132058.3359-1-inwardvessel@gmail.com/
      
      Fixes: d741bf41
      
       ("kprobes: Remove kretprobe hash")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJP Kobryn <inwardvessel@gmail.com>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95a4c959
    • Srinivas Kandagatla's avatar
      ASoC: ops: add correct range check for limiting volume · 395e52b7
      Srinivas Kandagatla authored
      commit fb9ad244
      
       upstream.
      
      Volume can have ranges that start with negative values, ex: -84dB to
      +40dB. Apply correct range check in snd_soc_limit_volume before setting
      the platform_max. Without this patch, for example setting a 0dB limit on
      a volume range of -84dB to +40dB would fail.
      
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Tested-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20231204124736.132185-2-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      395e52b7
    • Boerge Struempfel's avatar
      gpiolib: sysfs: Fix error handling on failed export · 6df51c52
      Boerge Struempfel authored
      [ Upstream commit 95dd1e34 ]
      
      If gpio_set_transitory() fails, we should free the GPIO again. Most
      notably, the flag FLAG_REQUESTED has previously been set in
      gpiod_request_commit(), and should be reset on failure.
      
      To my knowledge, this does not affect any current users, since the
      gpio_set_transitory() mainly returns 0 and -ENOTSUPP, which is converted
      to 0. However the gpio_set_transitory() function calles the .set_config()
      function of the corresponding GPIO chip and there are some GPIO drivers in
      which some (unlikely) branches return other values like -EPROBE_DEFER,
      and -EINVAL. In these cases, the above mentioned FLAG_REQUESTED would not
      be reset, which results in the pin being blocked until the next reboot.
      
      Fixes: e10f72bf
      
       ("gpio: gpiolib: Generalise state persistence beyond sleep")
      Signed-off-by: default avatarBoerge Struempfel <boerge.struempfel@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6df51c52
    • Ashwin Dayanand Kamat's avatar
      x86/sev: Fix kernel crash due to late update to read-only ghcb_version · 73bbca12
      Ashwin Dayanand Kamat authored
      [ Upstream commit 27d25348 ]
      
      A write-access violation page fault kernel crash was observed while running
      cpuhotplug LTP testcases on SEV-ES enabled systems. The crash was
      observed during hotplug, after the CPU was offlined and the process
      was migrated to different CPU. setup_ghcb() is called again which
      tries to update ghcb_version in sev_es_negotiate_protocol(). Ideally this
      is a read_only variable which is initialised during booting.
      
      Trying to write it results in a pagefault:
      
        BUG: unable to handle page fault for address: ffffffffba556e70
        #PF: supervisor write access in kernel mode
        #PF: error_code(0x0003) - permissions violation
        [ ...]
        Call Trace:
         <TASK>
         ? __die_body.cold+0x1a/0x1f
         ? __die+0x2a/0x35
         ? page_fault_oops+0x10c/0x270
         ? setup_ghcb+0x71/0x100
         ? __x86_return_thunk+0x5/0x6
         ? search_exception_tables+0x60/0x70
         ? __x86_return_thunk+0x5/0x6
         ? fixup_exception+0x27/0x320
         ? kernelmode_fixup_or_oops+0xa2/0x120
         ? __bad_area_nosemaphore+0x16a/0x1b0
         ? kernel_exc_vmm_communication+0x60/0xb0
         ? bad_area_nosemaphore+0x16/0x20
         ? do_kern_addr_fault+0x7a/0x90
         ? exc_page_fault+0xbd/0x160
         ? asm_exc_page_fault+0x27/0x30
         ? setup_ghcb+0x71/0x100
         ? setup_ghcb+0xe/0x100
         cpu_init_exception_handling+0x1b9/0x1f0
      
      The fix is to call sev_es_negotiate_protocol() only in the BSP boot phase,
      and it only needs to be done once in any case.
      
      [ mingo: Refined the changelog. ]
      
      Fixes: 95d33bfa
      
       ("x86/sev: Register GHCB memory when SEV-SNP is active")
      Suggested-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Co-developed-by: default avatarBo Gan <bo.gan@broadcom.com>
      Signed-off-by: default avatarBo Gan <bo.gan@broadcom.com>
      Signed-off-by: default avatarAshwin Dayanand Kamat <ashwin.kamat@broadcom.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Link: https://lore.kernel.org/r/1701254429-18250-1-git-send-email-kashwindayan@vmware.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      73bbca12
    • Peter Zijlstra's avatar
      perf: Fix perf_event_validate_size() · cfe9295d
      Peter Zijlstra authored
      [ Upstream commit 382c27f4 ]
      
      Budimir noted that perf_event_validate_size() only checks the size of
      the newly added event, even though the sizes of all existing events
      can also change due to not all events having the same read_format.
      
      When we attach the new event, perf_group_attach(), we do re-compute
      the size for all events.
      
      Fixes: a723968c
      
       ("perf: Fix u16 overflows")
      Reported-by: default avatarBudimir Markovic <markovicbudimir@gmail.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cfe9295d
    • Jiadong Zhu's avatar
      drm/amdgpu: disable MCBP by default · c66c4794
      Jiadong Zhu authored
      [ Upstream commit d6a57588 ]
      
      Disable MCBP(mid command buffer preemption) by default as old Mesa
      hangs with it. We shall not enable the feature that breaks old usermode
      driver.
      
      Fixes: 50a7c876
      
       ("drm/amdgpu: enable mcbp by default on gfx9")
      Signed-off-by: default avatarJiadong Zhu <Jiadong.Zhu@amd.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c66c4794
    • Hsin-Yi Wang's avatar
      arm64: dts: mt8183: kukui: Fix underscores in node names · 3798c665
      Hsin-Yi Wang authored
      [ Upstream commit 8980c301 ]
      
      Replace underscores with hyphens in pinctrl node names both for consistency
      and to adhere to the bindings.
      
      Cc: stable@vger.kernel.org
      Fixes: cd894e27 ("arm64: dts: mt8183: Add krane-sku176 board")
      Fixes: 1652dbf7 ("arm64: dts: mt8183: add scp node")
      Fixes: 27eaf34d
      
       ("arm64: dts: mt8183: config dsi node")
      Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Link: https://lore.kernel.org/r/20231026191343.3345279-2-hsinyi@chromium.org
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3798c665
    • Krzysztof Kozlowski's avatar
      arm64: dts: mediatek: add missing space before { · b6c47d91
      Krzysztof Kozlowski authored
      [ Upstream commit a9c740c5
      
       ]
      
      Add missing whitespace between node name/label and opening {.
      
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Link: https://lore.kernel.org/r/20230705150006.293690-2-krzysztof.kozlowski@linaro.org
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Stable-dep-of: 8980c301
      
       ("arm64: dts: mt8183: kukui: Fix underscores in node names")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b6c47d91
    • Helge Deller's avatar
      parisc: Fix asm operand number out of range build error in bug table · 5bdd0ced
      Helge Deller authored
      [ Upstream commit 48763575
      
       ]
      
      Build is broken if CONFIG_DEBUG_BUGVERBOSE=n.
      Fix it be using the correct asm operand number.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Reported-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Fixes: fe76a134
      
       ("parisc: Use natural CPU alignment for bug_table")
      Cc: stable@vger.kernel.org   # v6.0+
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5bdd0ced
    • Helge Deller's avatar
      parisc: Reduce size of the bug_table on 64-bit kernel by half · 16496064
      Helge Deller authored
      [ Upstream commit 43266838
      
       ]
      
      Enable GENERIC_BUG_RELATIVE_POINTERS which will store 32-bit relative
      offsets to the bug address and the source file name instead of 64-bit
      absolute addresses. This effectively reduces the size of the
      bug_table[] array by half on 64-bit kernels.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Stable-dep-of: 48763575
      
       ("parisc: Fix asm operand number out of range build error in bug table")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      16496064
    • Hengqi Chen's avatar
      LoongArch: BPF: Don't sign extend function return value · 4b117370
      Hengqi Chen authored
      [ Upstream commit 5d47ec2e ]
      
      The `cls_redirect` test triggers a kernel panic like:
      
        # ./test_progs -t cls_redirect
        Can't find bpf_testmod.ko kernel module: -2
        WARNING! Selftests relying on bpf_testmod.ko will be skipped.
        [   30.938489] CPU 3 Unable to handle kernel paging request at virtual address fffffffffd814de0, era == ffff800002009fb8, ra == ffff800002009f9c
        [   30.939331] Oops[#1]:
        [   30.939513] CPU: 3 PID: 1260 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 #35 a896aca3f4164f09cc346f89f2e09832e07be5f6
        [   30.939732] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022
        [   30.939901] pc ffff800002009fb8 ra ffff800002009f9c tp 9000000104da4000 sp 9000000104da7ab0
        [   30.940038] a0 fffffffffd814de0 a1 9000000104da7a68 a2 0000000000000000 a3 9000000104da7c10
        [   30.940183] a4 9000000104da7c14 a5 0000000000000002 a6 0000000000000021 a7 00005555904d7f90
        [   30.940321] t0 0000000000000110 t1 0000000000000000 t2 fffffffffd814de0 t3 0004c4b400000000
        [   30.940456] t4 ffffffffffffffff t5 00000000c3f63600 t6 0000000000000000 t7 0000000000000000
        [   30.940590] t8 000000000006d803 u0 0000000000000020 s9 9000000104da7b10 s0 900000010504c200
        [   30.940727] s1 fffffffffd814de0 s2 900000010504c200 s3 9000000104da7c10 s4 9000000104da7ad0
        [   30.940866] s5 0000000000000000 s6 90000000030e65bc s7 9000000104da7b44 s8 90000000044f6fc0
        [   30.941015]    ra: ffff800002009f9c bpf_prog_846803e5ae81417f_cls_redirect+0xa0/0x590
        [   30.941535]   ERA: ffff800002009fb8 bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590
        [   30.941696]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
        [   30.942224]  PRMD: 00000004 (PPLV0 +PIE -PWE)
        [   30.942330]  EUEN: 00000003 (+FPE +SXE -ASXE -BTE)
        [   30.942453]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
        [   30.942612] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
        [   30.942764]  BADV: fffffffffd814de0
        [   30.942854]  PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
        [   30.942974] Modules linked in:
        [   30.943078] Process test_progs (pid: 1260, threadinfo=00000000ce303226, task=000000007d10bb76)
        [   30.943306] Stack : 900000010a064000 90000000044f6fc0 9000000104da7b48 0000000000000000
        [   30.943495]         0000000000000000 9000000104da7c14 9000000104da7c10 900000010504c200
        [   30.943626]         0000000000000001 ffff80001b88c000 9000000104da7b70 90000000030e6668
        [   30.943785]         0000000000000000 9000000104da7b58 ffff80001b88c048 9000000003d05000
        [   30.943936]         900000000303ac88 0000000000000000 0000000000000000 9000000104da7b70
        [   30.944091]         0000000000000000 0000000000000001 0000000731eeab00 0000000000000000
        [   30.944245]         ffff80001b88c000 0000000000000000 0000000000000000 54b99959429f83b8
        [   30.944402]         ffff80001b88c000 90000000044f6fc0 9000000101d70000 ffff80001b88c000
        [   30.944538]         000000000000005a 900000010504c200 900000010a064000 900000010a067000
        [   30.944697]         9000000104da7d88 0000000000000000 9000000003d05000 90000000030e794c
        [   30.944852]         ...
        [   30.944924] Call Trace:
        [   30.945120] [<ffff800002009fb8>] bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590
        [   30.945650] [<90000000030e6668>] bpf_test_run+0x1ec/0x2f8
        [   30.945958] [<90000000030e794c>] bpf_prog_test_run_skb+0x31c/0x684
        [   30.946065] [<90000000026d4f68>] __sys_bpf+0x678/0x2724
        [   30.946159] [<90000000026d7288>] sys_bpf+0x20/0x2c
        [   30.946253] [<90000000032dd224>] do_syscall+0x7c/0x94
        [   30.946343] [<9000000002541c5c>] handle_syscall+0xbc/0x158
        [   30.946492]
        [   30.946549] Code: 0015030e  5c0009c0  5001d000 <28c00304> 02c00484  29c00304  00150009  2a42d2e4  0280200d
        [   30.946793]
        [   30.946971] ---[ end trace 0000000000000000 ]---
        [   32.093225] Kernel panic - not syncing: Fatal exception in interrupt
        [   32.093526] Kernel relocated by 0x2320000
        [   32.093630]  .text @ 0x9000000002520000
        [   32.093725]  .data @ 0x9000000003400000
        [   32.093792]  .bss  @ 0x9000000004413200
        [   34.971998] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
      
      This is because we signed-extend function return values. When subprog
      mode is enabled, we have:
      
        cls_redirect()
          -> get_global_metrics() returns pcpu ptr 0xfffffefffc00b480
      
      The pointer returned is later signed-extended to 0xfffffffffc00b480 at
      `BPF_JMP | BPF_EXIT`. During BPF prog run, this triggers unhandled page
      fault and a kernel panic.
      
      Drop the unnecessary signed-extension on return values like other
      architectures do.
      
      With this change, we have:
      
        # ./test_progs -t cls_redirect
        Can't find bpf_testmod.ko kernel module: -2
        WARNING! Selftests relying on bpf_testmod.ko will be skipped.
        #51/1    cls_redirect/cls_redirect_inlined:OK
        #51/2    cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK
        #51/3    cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK
        #51/4    cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK
        #51/5    cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK
        #51/6    cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK
        #51/7    cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK
        #51/8    cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK
        #51/9    cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK
        #51/10   cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK
        #51/11   cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK
        #51/12   cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK
        #51/13   cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK
        #51/14   cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK
        #51/15   cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK
        #51/16   cls_redirect/cls_redirect_subprogs:OK
        #51/17   cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK
        #51/18   cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK
        #51/19   cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK
        #51/20   cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK
        #51/21   cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK
        #51/22   cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK
        #51/23   cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK
        #51/24   cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK
        #51/25   cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK
        #51/26   cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK
        #51/27   cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK
        #51/28   cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK
        #51/29   cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK
        #51/30   cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK
        #51/31   cls_redirect/cls_redirect_dynptr:OK
        #51/32   cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK
        #51/33   cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK
        #51/34   cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK
        #51/35   cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK
        #51/36   cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK
        #51/37   cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK
        #51/38   cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK
        #51/39   cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK
        #51/40   cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK
        #51/41   cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK
        #51/42   cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK
        #51/43   cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK
        #51/44   cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK
        #51/45   cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK
        #51      cls_redirect:OK
        Summary: 1/45 PASSED, 0 SKIPPED, 0 FAILED
      
      Fixes: 5dc61552
      
       ("LoongArch: Add BPF JIT support")
      Signed-off-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4b117370
    • Hengqi Chen's avatar
      LoongArch: BPF: Don't sign extend memory load operand · 3275410b
      Hengqi Chen authored
      [ Upstream commit fe575755 ]
      
      The `cgrp_local_storage` test triggers a kernel panic like:
      
        # ./test_progs -t cgrp_local_storage
        Can't find bpf_testmod.ko kernel module: -2
        WARNING! Selftests relying on bpf_testmod.ko will be skipped.
        [  550.930632] CPU 1 Unable to handle kernel paging request at virtual address 0000000000000080, era == ffff80000200be34, ra == ffff80000200be00
        [  550.931781] Oops[#1]:
        [  550.931966] CPU: 1 PID: 1303 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 #35 a896aca3f4164f09cc346f89f2e09832e07be5f6
        [  550.932215] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022
        [  550.932403] pc ffff80000200be34 ra ffff80000200be00 tp 9000000108350000 sp 9000000108353dc0
        [  550.932545] a0 0000000000000000 a1 0000000000000517 a2 0000000000000118 a3 00007ffffbb15558
        [  550.932682] a4 00007ffffbb15620 a5 90000001004e7700 a6 0000000000000021 a7 0000000000000118
        [  550.932824] t0 ffff80000200bdc0 t1 0000000000000517 t2 0000000000000517 t3 00007ffff1c06ee0
        [  550.932961] t4 0000555578ae04d0 t5 fffffffffffffff8 t6 0000000000000004 t7 0000000000000020
        [  550.933097] t8 0000000000000040 u0 00000000000007b8 s9 9000000108353e00 s0 90000001004e7700
        [  550.933241] s1 9000000004005000 s2 0000000000000001 s3 0000000000000000 s4 0000555555eb2ec8
        [  550.933379] s5 00007ffffbb15bb8 s6 00007ffff1dafd60 s7 000055555663f610 s8 00007ffff1db0050
        [  550.933520]    ra: ffff80000200be00 bpf_prog_98f1b9e767be2a84_on_enter+0x40/0x200
        [  550.933911]   ERA: ffff80000200be34 bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200
        [  550.934105]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
        [  550.934596]  PRMD: 00000004 (PPLV0 +PIE -PWE)
        [  550.934712]  EUEN: 00000003 (+FPE +SXE -ASXE -BTE)
        [  550.934836]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
        [  550.934976] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
        [  550.935097]  BADV: 0000000000000080
        [  550.935181]  PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
        [  550.935291] Modules linked in:
        [  550.935391] Process test_progs (pid: 1303, threadinfo=000000006c3b1c41, task=0000000061f84a55)
        [  550.935643] Stack : 00007ffffbb15bb8 0000555555eb2ec8 0000000000000000 0000000000000001
        [  550.935844]         9000000004005000 ffff80001b864000 00007ffffbb15450 90000000029aa034
        [  550.935990]         0000000000000000 9000000108353ec0 0000000000000118 d07d9dfb09721a09
        [  550.936175]         0000000000000001 0000000000000000 9000000108353ec0 0000000000000118
        [  550.936314]         9000000101d46ad0 900000000290abf0 000055555663f610 0000000000000000
        [  550.936479]         0000000000000003 9000000108353ec0 00007ffffbb15450 90000000029d7288
        [  550.936635]         00007ffff1dafd60 000055555663f610 0000000000000000 0000000000000003
        [  550.936779]         9000000108353ec0 90000000035dd1f0 00007ffff1dafd58 9000000002841c5c
        [  550.936939]         0000000000000119 0000555555eea5a8 00007ffff1d78780 00007ffffbb153e0
        [  550.937083]         ffffffffffffffda 00007ffffbb15518 0000000000000040 00007ffffbb15558
        [  550.937224]         ...
        [  550.937299] Call Trace:
        [  550.937521] [<ffff80000200be34>] bpf_prog_98f1b9e767be2a84_on_enter+0x74/0x200
        [  550.937910] [<90000000029aa034>] bpf_trace_run2+0x90/0x154
        [  550.938105] [<900000000290abf0>] syscall_trace_enter.isra.0+0x1cc/0x200
        [  550.938224] [<90000000035dd1f0>] do_syscall+0x48/0x94
        [  550.938319] [<9000000002841c5c>] handle_syscall+0xbc/0x158
        [  550.938477]
        [  550.938607] Code: 580009ae  50016000  262402e4 <28c20085> 14092084  03a00084  16000024  03240084  00150006
        [  550.938851]
        [  550.939021] ---[ end trace 0000000000000000 ]---
      
      Further investigation shows that this panic is triggered by memory
      load operations:
      
        ptr = bpf_cgrp_storage_get(&map_a, task->cgroups->dfl_cgrp, 0,
                                   BPF_LOCAL_STORAGE_GET_F_CREATE);
      
      The expression `task->cgroups->dfl_cgrp` involves two memory load.
      Since the field offset fits in imm12 or imm14, we use ldd or ldptrd
      instructions. But both instructions have the side effect that it will
      signed-extended the imm operand. Finally, we got the wrong addresses
      and panics is inevitable.
      
      Use a generic ldxd instruction to avoid this kind of issues.
      
      With this change, we have:
      
        # ./test_progs -t cgrp_local_storage
        Can't find bpf_testmod.ko kernel module: -2
        WARNING! Selftests relying on bpf_testmod.ko will be skipped.
        test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec
        #48/1    cgrp_local_storage/tp_btf:OK
        test_attach_cgroup:PASS:skel_open 0 nsec
        test_attach_cgroup:PASS:prog_attach 0 nsec
        test_attach_cgroup:PASS:prog_attach 0 nsec
        libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22
        test_attach_cgroup:FAIL:prog_attach unexpected error: -524
        #48/2    cgrp_local_storage/attach_cgroup:FAIL
        test_recursion:PASS:skel_open_and_load 0 nsec
        libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22
        libbpf: prog 'on_lookup': failed to auto-attach: -524
        test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524)
        #48/3    cgrp_local_storage/recursion:FAIL
        #48/4    cgrp_local_storage/negative:OK
        #48/5    cgrp_local_storage/cgroup_iter_sleepable:OK
        test_yes_rcu_lock:PASS:skel_open 0 nsec
        test_yes_rcu_lock:PASS:skel_load 0 nsec
        libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22
        libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524
        test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524)
        #48/6    cgrp_local_storage/yes_rcu_lock:FAIL
        #48/7    cgrp_local_storage/no_rcu_lock:OK
        #48      cgrp_local_storage:FAIL
      
        All error logs:
        test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec
        test_attach_cgroup:PASS:skel_open 0 nsec
        test_attach_cgroup:PASS:prog_attach 0 nsec
        test_attach_cgroup:PASS:prog_attach 0 nsec
        libbpf: prog 'update_cookie_tracing': failed to attach: ERROR: strerror_r(-524)=22
        test_attach_cgroup:FAIL:prog_attach unexpected error: -524
        #48/2    cgrp_local_storage/attach_cgroup:FAIL
        test_recursion:PASS:skel_open_and_load 0 nsec
        libbpf: prog 'on_lookup': failed to attach: ERROR: strerror_r(-524)=22
        libbpf: prog 'on_lookup': failed to auto-attach: -524
        test_recursion:FAIL:skel_attach unexpected error: -524 (errno 524)
        #48/3    cgrp_local_storage/recursion:FAIL
        test_yes_rcu_lock:PASS:skel_open 0 nsec
        test_yes_rcu_lock:PASS:skel_load 0 nsec
        libbpf: prog 'yes_rcu_lock': failed to attach: ERROR: strerror_r(-524)=22
        libbpf: prog 'yes_rcu_lock': failed to auto-attach: -524
        test_yes_rcu_lock:FAIL:skel_attach unexpected error: -524 (errno 524)
        #48/6    cgrp_local_storage/yes_rcu_lock:FAIL
        #48      cgrp_local_storage:FAIL
        Summary: 0/4 PASSED, 0 SKIPPED, 1 FAILED
      
      No panics any more (The test still failed because lack of BPF trampoline
      which I am actively working on).
      
      Fixes: 5dc61552
      
       ("LoongArch: Add BPF JIT support")
      Signed-off-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3275410b
    • Ilkka Koskinen's avatar
      perf vendor events arm64: AmpereOne: Add missing DefaultMetricgroupName fields · 0fdd1b88
      Ilkka Koskinen authored
      [ Upstream commit 90fe70d4 ]
      
      AmpereOne metrics were missing DefaultMetricgroupName from metrics with
      "Default" in group name resulting perf to segfault. Add the missing
      field to address the issue.
      
      Fixes: 59faeaf8
      
       ("perf vendor events arm64: Fix for AmpereOne metrics")
      Signed-off-by: default avatarIlkka Koskinen <ilkka@os.amperecomputing.com>
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20231201021550.1109196-2-ilkka@os.amperecomputing.com
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0fdd1b88
    • Su Hui's avatar
      misc: mei: client.c: fix problem of return '-EOVERFLOW' in mei_cl_write · f78fff46
      Su Hui authored
      [ Upstream commit ee623602 ]
      
      Clang static analyzer complains that value stored to 'rets' is never
      read.Let 'buf_len = -EOVERFLOW' to make sure we can return '-EOVERFLOW'.
      
      Fixes: 8c8d964c
      
       ("mei: move hbuf_depth from the mei device to the hw modules")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Link: https://lore.kernel.org/r/20231120095523.178385-2-suhui@nfschina.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f78fff46
    • Su Hui's avatar
      misc: mei: client.c: return negative error code in mei_cl_write · e2365ead
      Su Hui authored
      [ Upstream commit 8f06aee8 ]
      
      mei_msg_hdr_init() return negative error code, rets should be
      'PTR_ERR(mei_hdr)' rather than '-PTR_ERR(mei_hdr)'.
      
      Fixes: 0cd7c01a
      
       ("mei: add support for mei extended header.")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Link: https://lore.kernel.org/r/20231120095523.178385-1-suhui@nfschina.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e2365ead
    • Junhao He's avatar
      coresight: ultrasoc-smb: Fix uninitialized before use buf_hw_base · c541d0ed
      Junhao He authored
      [ Upstream commit 862c135b ]
      
      In smb_reset_buffer, the sdb->buf_hw_base variable is uninitialized
      before use, which initializes it in smb_init_data_buffer. And the SMB
      regiester are set in smb_config_inport.
      So move the call after smb_config_inport.
      
      Fixes: 06f5c292
      
       ("drivers/coresight: Add UltraSoc System Memory Buffer driver")
      Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20231114133346.30489-4-hejunhao3@huawei.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c541d0ed
    • Junhao He's avatar
      coresight: ultrasoc-smb: Config SMB buffer before register sink · ab5091e1
      Junhao He authored
      [ Upstream commit 830a7f54 ]
      
      The SMB dirver register the enable/disable sysfs interface in function
      smb_register_sink(), however the buffer depends on the following
      configuration to work well. So it'll be possible for user to access an
      unreset one.
      
      Move the config buffer operation to before register_sink().
      Ignore the return value, if smb_config_inport() fails. That will
      cause the hardwares disable trace path to fail, should not affect
      SMB driver remove. So we make smb_remove() return success,
      
      Fixes: 06f5c292
      
       ("drivers/coresight: Add UltraSoc System Memory Buffer driver")
      Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20231114133346.30489-3-hejunhao3@huawei.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ab5091e1
    • Junhao He's avatar
      coresight: ultrasoc-smb: Fix sleep while close preempt in enable_smb · ace850bd
      Junhao He authored
      [ Upstream commit b8411287 ]
      
      When we to enable the SMB by perf, the perf sched will call perf_ctx_lock()
      to close system preempt in event_function_call(). But SMB::enable_smb() use
      mutex to lock the critical section, which may sleep.
      
       BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580
       in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 153023, name: perf
       preempt_count: 2, expected: 0
       RCU nest depth: 0, expected: 0
       INFO: lockdep is turned off.
       irq event stamp: 0
       hardirqs last  enabled at (0): [<0000000000000000>] 0x0
       hardirqs last disabled at (0): [<ffffa2983f5c5f40>] copy_process+0xae8/0x2b48
       softirqs last  enabled at (0): [<ffffa2983f5c5f40>] copy_process+0xae8/0x2b48
       softirqs last disabled at (0): [<0000000000000000>] 0x0
       CPU: 2 PID: 153023 Comm: perf Kdump: loaded Tainted: G   W  O   6.5.0-rc4+ #1
      
       Call trace:
       ...
        __mutex_lock+0xbc/0xa70
        mutex_lock_nested+0x34/0x48
        smb_update_buffer+0x58/0x360 [ultrasoc_smb]
        etm_event_stop+0x204/0x2d8 [coresight]
        etm_event_del+0x1c/0x30 [coresight]
        event_sched_out+0x17c/0x3b8
        group_sched_out.part.0+0x5c/0x208
        __perf_event_disable+0x15c/0x210
        event_function+0xe0/0x230
        remote_function+0xb4/0xe8
        generic_exec_single+0x160/0x268
        smp_call_function_single+0x20c/0x2a0
        event_function_call+0x20c/0x220
        _perf_event_disable+0x5c/0x90
        perf_event_for_each_child+0x58/0xc0
        _perf_ioctl+0x34c/0x1250
        perf_ioctl+0x64/0x98
       ...
      
      Use spinlock to replace mutex to control driver data access to one at a
      time. The function copy_to_user() may sleep, it cannot be in a spinlock
      context, so we can't simply replace it in smb_read(). But we can ensure
      that only one user gets the SMB device fd by smb_open(), so remove the
      locks from smb_read() and buffer synchronization is guaranteed by the user.
      
      Fixes: 06f5c292
      
       ("drivers/coresight: Add UltraSoc System Memory Buffer driver")
      Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20231114133346.30489-2-hejunhao3@huawei.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ace850bd
    • Junhao He's avatar
      hwtracing: hisi_ptt: Add dummy callback pmu::read() · 359d3fbc
      Junhao He authored
      [ Upstream commit 55e0a2fb ]
      
      When start trace with perf option "-C $cpu" and immediately stop it
      with SIGTERM or others, the perf core will invoke pmu::read() while
      the driver doesn't implement it. Add a dummy pmu::read() to avoid
      any issues.
      
      Fixes: ff0de066
      
       ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device")
      Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
      Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
      Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20231010084731.30450-6-yangyicong@huawei.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      359d3fbc
    • James Clark's avatar
      coresight: Fix crash when Perf and sysfs modes are used concurrently · 2f6b1527
      James Clark authored
      [ Upstream commit 287e82cf ]
      
      Partially revert the change in commit 61486528
      
       ("coresight: Enable
      and disable helper devices adjacent to the path") which changed the bare
      call from source_ops(csdev)->enable() to coresight_enable_source() for
      Perf sessions. It was missed that coresight_enable_source() is
      specifically for the sysfs interface, rather than being a generic call.
      This interferes with the sysfs reference counting to cause the following
      crash:
      
        $ perf record -e cs_etm/@tmc_etr0/ -C 0 &
        $ echo 1 > /sys/bus/coresight/devices/tmc_etr0/enable_sink
        $ echo 1 > /sys/bus/coresight/devices/etm0/enable_source
        $ echo 0 > /sys/bus/coresight/devices/etm0/enable_source
      
        Unable to handle kernel NULL pointer dereference at virtual
        address 00000000000001d0
        Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
        ...
        Call trace:
         etm4_disable+0x54/0x150 [coresight_etm4x]
         coresight_disable_source+0x6c/0x98 [coresight]
         coresight_disable+0x74/0x1c0 [coresight]
         enable_source_store+0x88/0xa0 [coresight]
         dev_attr_store+0x20/0x40
         sysfs_kf_write+0x4c/0x68
         kernfs_fop_write_iter+0x120/0x1b8
         vfs_write+0x2dc/0x3b0
         ksys_write+0x70/0x108
         __arm64_sys_write+0x24/0x38
         invoke_syscall+0x50/0x128
         el0_svc_common.constprop.0+0x104/0x130
         do_el0_svc+0x40/0xb8
         el0_svc+0x2c/0xb8
         el0t_64_sync_handler+0xc0/0xc8
         el0t_64_sync+0x1a4/0x1a8
        Code: d53cd042 91002000 b9402a81 b8626800 (f940ead5)
        ---[ end trace 0000000000000000 ]---
      
      This commit linked below also fixes the issue, but has unlocked updates
      to the mode which could potentially race. So until we come up with a
      more complete solution that takes all locking and interaction between
      both modes into account, just revert back to the old behavior for Perf.
      
      Reported-by: default avatarJunhao He <hejunhao3@huawei.com>
      Closes: https://lore.kernel.org/linux-arm-kernel/20230921132904.60996-1-hejunhao3@huawei.com/
      Fixes: 61486528
      
       ("coresight: Enable and disable helper devices adjacent to the path")
      Tested-by: default avatarJunhao He <hejunhao3@huawei.com>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20231006131452.646721-1-james.clark@arm.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2f6b1527
    • Uwe Kleine-König's avatar
      coresight: etm4x: Remove bogous __exit annotation for some functions · 1b5d156c
      Uwe Kleine-König authored
      [ Upstream commit 348ddab8 ]
      
      etm4_platform_driver (which lives in ".data" contains a reference to
      etm4_remove_platform_dev(). So the latter must not be marked with __exit
      which results in the function being discarded for a build with
      CONFIG_CORESIGHT_SOURCE_ETM4X=y which in turn makes the remove pointer
      contain invalid data.
      
      etm4x_amba_driver referencing etm4_remove_amba() has the same issue.
      
      Drop the __exit annotations for the two affected functions and a third
      one that is called by the other two.
      
      For reasons I don't understand this isn't catched by building with
      CONFIG_DEBUG_SECTION_MISMATCH=y.
      
      Fixes: c23bc382 ("coresight: etm4x: Refactor probing routine")
      Fixes: 5214b563
      
       ("coresight: etm4x: Add support for sysreg only devices")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Link: https://lore.kernel.org/all/20230929081540.yija47lsj35xtj4v@pengutronix.de/
      Link: https://lore.kernel.org/r/20230929081637.2377335-1-u.kleine-koenig@pengutronix.de
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1b5d156c
    • AngeloGioacchino Del Regno's avatar
      arm64: dts: mediatek: mt8186: Change gpu speedbin nvmem cell name · b9cc1708
      AngeloGioacchino Del Regno authored
      commit 59fa1e51 upstream.
      
      MT8186's GPU speedbin value must be interpreted, or the value will not
      be meaningful.
      Use the correct "gpu-speedbin" nvmem cell name for the GPU speedbin to
      allow triggering the cell info fixup handler, hence feeding the right
      speedbin number to the users.
      
      Cc: stable@vger.kernel.org
      Fixes: 263d2fd0
      
       ("arm64: dts: mediatek: mt8186: Add GPU speed bin NVMEM cells")
      Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Link: https://lore.kernel.org/r/20231005151150.355536-1-angelogioacchino.delregno@collabora.com
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9cc1708
    • Eugen Hristev's avatar
      arm64: dts: mediatek: mt8186: fix clock names for power domains · b6eccbcb
      Eugen Hristev authored
      commit 9adf7580 upstream.
      
      Clocks for each power domain are split into big categories: pd clocks
      and subsys clocks.
      According to the binding, all clocks which have a dash '-' in their name
      are treated as subsys clocks, and must be placed at the end of the list.
      The other clocks which are pd clocks must come first.
      Fixed the naming and the placing of all clocks in the power domains.
      For the avoidance of doubt, prefixed all subsys clocks with the 'subsys'
      prefix. The binding does not enforce strict clock names, the driver
      uses them in bulk, only making a difference for pd clocks vs subsys clocks.
      
      The above problem appears to be trivial, however, it leads to incorrect
      power up and power down sequence of the power domains, because some
      clocks will be mistakenly taken for subsys clocks and viceversa.
      One consequence is the fact that if the DIS power domain goes power down
      and power back up during the boot process, when it comes back up, there
      are still transactions left on the bus which makes the display inoperable.
      
      Some of the clocks for the DIS power domain were wrongly using '_' instead
      of '-', which again made these clocks being treated as pd clocks instead of
      subsys clocks.
      
      Cc: stable@vger.kernel.org
      Fixes: d9e43c1e
      
       ("arm64: dts: mt8186: Add power domains controller")
      Signed-off-by: default avatarEugen Hristev <eugen.hristev@collabora.com>
      Tested-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Tested-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Reviewed-by: default avatarAlexandre Mergnat <amergnat@baylibre.com>
      Link: https://lore.kernel.org/r/20231005103041.352478-1-eugen.hristev@collabora.com
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6eccbcb
    • AngeloGioacchino Del Regno's avatar
      arm64: dts: mediatek: mt8183-evb: Fix unit_address_vs_reg warning on ntc · 2e465268
      AngeloGioacchino Del Regno authored
      commit 9dea1c72 upstream.
      
      The NTC is defined as ntc@0 but it doesn't need any address at all.
      Fix the unit_address_vs_reg warning by dropping the unit address: since
      the node name has to be generic also fully rename it from ntc@0 to
      thermal-sensor.
      
      Cc: stable@vger.kernel.org
      Fixes: ff9ea5c6
      
       ("arm64: dts: mediatek: mt8183-evb: Add node for thermistor")
      Link: https://lore.kernel.org/r/20231025093816.44327-7-angelogioacchino.delregno@collabora.com
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e465268
    • AngeloGioacchino Del Regno's avatar
      arm64: dts: mediatek: mt8183: Move thermal-zones to the root node · bfff27fb
      AngeloGioacchino Del Regno authored
      commit 5a60d634 upstream.
      
      The thermal zones are not a soc bus device: move it to the root
      node to solve simple_bus_reg warnings.
      
      Cc: stable@vger.kernel.org
      Fixes: b325ce39
      
       ("arm64: dts: mt8183: add thermal zone node")
      Link: https://lore.kernel.org/r/20231025093816.44327-9-angelogioacchino.delregno@collabora.com
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bfff27fb
    • AngeloGioacchino Del Regno's avatar
      arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory · d97373c3
      AngeloGioacchino Del Regno authored
      commit 19cba9a6 upstream.
      
      The reserved memory for scp had node name "scp_mem_region" and also
      without unit-address: change the name to "memory@(address)".
      This fixes a unit_address_vs_reg warning.
      
      Cc: stable@vger.kernel.org
      Fixes: 1652dbf7
      
       ("arm64: dts: mt8183: add scp node")
      Link: https://lore.kernel.org/r/20231025093816.44327-6-angelogioacchino.delregno@collabora.com
      Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d97373c3