1. Jun 21, 2023
    • Sunil V L's avatar
      RISC-V: smpboot: Create wrapper setup_smp() · 65fa37dd
      Sunil V L authored
      
      
      setup_smp() currently assumes DT-based platforms. To enable ACPI,
      first make this a wrapper function and move existing code to
      a separate DT-specific function.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      65fa37dd
    • Sunil V L's avatar
      drivers/acpi: RISC-V: Add RHCT related code · 19fe4a55
      Sunil V L authored
      
      
      RHCT is a new table defined for RISC-V to communicate the
      features of the CPU to the OS. Create a new architecture folder
      in drivers/acpi and add RHCT parsing code.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      19fe4a55
    • Sunil V L's avatar
      RISC-V: ACPI: Cache and retrieve the RINTC structure · 30072e73
      Sunil V L authored
      
      
      RINTC structures in the MADT provide mapping between the hartid
      and the CPU. This is required many times even at run time like
      cpuinfo. So, instead of parsing the ACPI table every time, cache
      the RINTC structures and provide a function to get the correct
      RINTC structure for a given cpu.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      30072e73
    • Sunil V L's avatar
      RISC-V: Add ACPI initialization in setup_arch() · d74e8259
      Sunil V L authored
      
      
      Initialize the ACPI core for RISC-V during boot.
      
      ACPI tables and interpreter are initialized based on
      the information passed from the firmware and the value of
      the kernel parameter 'acpi'.
      
      With ACPI support added for RISC-V, the kernel parameter 'acpi'
      is also supported on RISC-V. Hence, update the documentation.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Acked-by: default avatarConor Dooley <conor.dooley@microchip.com>
      d74e8259
    • Sunil V L's avatar
      ACPI: processor_core: RISC-V: Enable mapping processor to the hartid · 1947aefd
      Sunil V L authored
      
      
      processor_core needs arch-specific functions to map the ACPI ID
      to the physical ID. In RISC-V platforms, hartid is the physical id
      and RINTC structure in MADT provides this mapping. Add arch-specific
      function to get this mapping from RINTC.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      1947aefd
    • Sunil V L's avatar
      RISC-V: Add support to build the ACPI core · 7d2d4775
      Sunil V L authored
      
      
      Enable ACPI core for RISC-V after adding architecture-specific
      interfaces and header files required to build the ACPI core.
      
      1) Couple of header files are required unconditionally by the ACPI
      core. Add empty acenv.h and cpu.h header files.
      
      2) If CONFIG_PCI is enabled, a few PCI related interfaces need to
      be provided by the architecture. Define dummy interfaces for now
      so that build succeeds. Actual implementation will be added when
      PCI support is added for ACPI along with external interrupt
      controller support.
      
      3) A few globals and memory mapping related functions specific
      to the architecture need to be provided.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      7d2d4775
    • Sunil V L's avatar
      ACPI: OSL: Make should_use_kmap() 0 for RISC-V · 1b56a9a4
      Sunil V L authored
      
      
      Without this, if the tables are larger than 4K,
      acpi_map() will fail.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1b56a9a4
    • Sunil V L's avatar
      ACPI: tables: Print RINTC information when MADT is parsed · b8d7e3c3
      Sunil V L authored
      
      
      When MADT is parsed, print RINTC information as below:
      
      ACPI: RISC-V INTC (acpi_uid[0x0000] hart_id[0x0] enabled)
      ACPI: RISC-V INTC (acpi_uid[0x0001] hart_id[0x1] enabled)
      ...
      ACPI: RISC-V INTC (acpi_uid[0x000f] hart_id[0xf] enabled)
      
      This debug information will be very helpful during bring up.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      b8d7e3c3
    • Sunil V L's avatar
      crypto: hisilicon/qm: Fix to enable build with RISC-V clang · cb117f4d
      Sunil V L authored
      With CONFIG_ACPI enabled for RISC-V, this driver gets enabled in
      allmodconfig build. However, build fails with clang and below
      error is seen.
      
      drivers/crypto/hisilicon/qm.c:627:10: error: invalid output constraint '+Q' in asm
                             "+Q" (*((char __iomem *)fun_base))
                             ^
      This is expected error with clang due to the way it is designed.
      
      To fix this issue, move arm64 assembly code under #if.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/999
      
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      [sunilvl@ventanamicro.com: Moved tmp0 and tmp1 into the #if]
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      cb117f4d
    • Sunil V L's avatar
      platform/surface: Disable for RISC-V · 609d4be8
      Sunil V L authored
      
      
      With CONFIG_ACPI enabled for RISC-V, this driver gets enabled
      in allmodconfig build. However, RISC-V doesn't support sub-word
      atomics which is used by this driver. Due to this, the build fails
      with below error.
      
      In function ‘ssh_seq_next’,
          inlined from ‘ssam_request_write_data’ at drivers/platform/surface/aggregator/controller.c:1483:8:
      ././include/linux/compiler_types.h:399:45: error: call to ‘__compiletime_assert_335’ declared with attribute error: BUILD_BUG failed
        399 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
            |                                             ^
      ./include/linux/compiler.h:78:45: note: in definition of macro ‘unlikely’
         78 | # define unlikely(x)    __builtin_expect(!!(x), 0)
            |                                             ^
      ././include/linux/compiler_types.h:387:9: note: in expansion of macro ‘__compiletime_assert’
        387 |         __compiletime_assert(condition, msg, prefix, suffix)
            |         ^~~~~~~~~~~~~~~~~~~~
      ././include/linux/compiler_types.h:399:9: note: in expansion of macro ‘_compiletime_assert’
        399 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
            |         ^~~~~~~~~~~~~~~~~~~
      ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
         39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
            |                                     ^~~~~~~~~~~~~~~~~~
      ./include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
         59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
            |                     ^~~~~~~~~~~~~~~~
      ./arch/riscv/include/asm/cmpxchg.h:335:17: note: in expansion of macro ‘BUILD_BUG’
        335 |                 BUILD_BUG();                                            \
            |                 ^~~~~~~~~
      ./arch/riscv/include/asm/cmpxchg.h:344:30: note: in expansion of macro ‘__cmpxchg’
        344 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
            |                              ^~~~~~~~~
      ./include/linux/atomic/atomic-instrumented.h:1916:9: note: in expansion of macro ‘arch_cmpxchg’
       1916 |         arch_cmpxchg(__ai_ptr, __VA_ARGS__); \
            |         ^~~~~~~~~~~~
      drivers/platform/surface/aggregator/controller.c:61:32: note: in expansion of macro ‘cmpxchg’
         61 |         while (unlikely((ret = cmpxchg(&c->value, old, new)) != old)) {
            |                                ^~~~~~~
      
      There is currently no plan to support this driver for RISC-V. So,
      disable this driver for RISC-V even when ACPI is enabled for now.
      
      Signed-off-by: default avatarSunil V L <sunilvl@ventanamicro.com>
      Acked-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      609d4be8
    • Jisheng Zhang's avatar
      riscv: move sbi_init() earlier before jump_label_init() · eec71cf1
      Jisheng Zhang authored
      
      
      We call jump_label_init() in setup_arch() is to use static key
      mechanism earlier, but riscv jump label relies on the sbi functions,
      If we enable static key before sbi_init(), the code path looks like:
        static_branch_enable()
          ..
            arch_jump_label_transform()
              patch_text_nosync()
                flush_icache_range()
                  flush_icache_all()
                    sbi_remote_fence_i() for CONFIG_RISCV_SBI case
                      __sbi_rfence()
      
      Since sbi isn't initialized, so NULL deference! Here is a typical
      panic log:
      
      [    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
      [    0.000000] Oops [#1]
      [    0.000000] Modules linked in:
      [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc7+ #79
      [    0.000000] Hardware name: riscv-virtio,qemu (DT)
      [    0.000000] epc : 0x0
      [    0.000000]  ra : sbi_remote_fence_i+0x1e/0x26
      [    0.000000] epc : 0000000000000000 ra : ffffffff80005826 sp : ffffffff80c03d50
      [    0.000000]  gp : ffffffff80ca6178 tp : ffffffff80c0ad80 t0 : 6200000000000000
      [    0.000000]  t1 : 0000000000000000 t2 : 62203a6b746e6972 s0 : ffffffff80c03d60
      [    0.000000]  s1 : ffffffff80001af6 a0 : 0000000000000000 a1 : 0000000000000000
      [    0.000000]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
      [    0.000000]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000080200
      [    0.000000]  s2 : ffffffff808b3e48 s3 : ffffffff808bf698 s4 : ffffffff80cb2818
      [    0.000000]  s5 : 0000000000000001 s6 : ffffffff80c9c345 s7 : ffffffff80895aa0
      [    0.000000]  s8 : 0000000000000001 s9 : 000000000000007f s10: 0000000000000000
      [    0.000000]  s11: 0000000000000000 t3 : ffffffff80824d08 t4 : 0000000000000022
      [    0.000000]  t5 : 000000000000003d t6 : 0000000000000000
      [    0.000000] status: 0000000000000100 badaddr: 0000000000000000 cause: 000000000000000c
      [    0.000000] ---[ end trace 0000000000000000 ]---
      [    0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
      [    0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
      
      Fix this issue by moving sbi_init() earlier before jump_label_init()
      
      Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Reviewed-by: default avatarAtish Patra <atishp@rivosinc.com>
      eec71cf1
  2. Jun 20, 2023
  3. Jun 19, 2023
  4. Jun 18, 2023
    • Damien Le Moal's avatar
      ata: libata-scsi: Avoid deadlock on rescan after device resume · 6aa0365a
      Damien Le Moal authored
      
      
      When an ATA port is resumed from sleep, the port is reset and a power
      management request issued to libata EH to reset the port and rescanning
      the device(s) attached to the port. Device rescanning is done by
      scheduling an ata_scsi_dev_rescan() work, which will execute
      scsi_rescan_device().
      
      However, scsi_rescan_device() takes the generic device lock, which is
      also taken by dpm_resume() when the SCSI device is resumed as well. If
      a device rescan execution starts before the completion of the SCSI
      device resume, the rcu locking used to refresh the cached VPD pages of
      the device, combined with the generic device locking from
      scsi_rescan_device() and from dpm_resume() can cause a deadlock.
      
      Avoid this situation by changing struct ata_port scsi_rescan_task to be
      a delayed work instead of a simple work_struct. ata_scsi_dev_rescan() is
      modified to check if the SCSI device associated with the ATA device that
      must be rescanned is not suspended. If the SCSI device is still
      suspended, ata_scsi_dev_rescan() returns early and reschedule itself for
      execution after an arbitrary delay of 5ms.
      
      Reported-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Reported-by: default avatarJoe Breuer <linux-kernel@jmbreuer.net>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217530
      Fixes: a19a93e4
      
       ("scsi: core: pm: Rely on the device driver core for async power management")
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarJoe Breuer <linux-kernel@jmbreuer.net>
      6aa0365a
    • Linus Torvalds's avatar
      Merge tag 'staging-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 1b29d271
      Linus Torvalds authored
      Pull staging driver fix from Greg KH:
       "Here is a single staging driver "fix" for 6.4-rc7. I've been sitting
        on it in my tree for many weeks as it is just a simple documentation
        update, with the hope that maybe some other staging driver fixes would
        need to be merged for 6.4-final, but that does not seem to be the
        case.
      
        So please, pull in this one documentation update so that Aaro doesn't
        get emails going forward that he can't do anything about"
      
      * tag 'staging-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: octeon: delete my name from TODO contact
      1b29d271
    • Linus Torvalds's avatar
      Merge tag 'usb-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 670062e7
      Linus Torvalds authored
      Pull USB / Thunderbolt fixes from Greg KH:
       "Here are some small USB and Thunderbolt driver fixes and new device
        ids for 6.4-rc7 to resolve some reported problems. Included in here
        are:
      
         - new USB serial device ids
      
         - USB gadget core fixes for long-dissussed problems
      
         - dwc3 bugfixes for reported issues.
      
         - typec driver fixes
      
         - thunderbolt driver fixes
      
        All of these have been in linux-next this week with no reported issues"
      
      * tag 'usb-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: gadget: udc: core: Prevent soft_connect_store() race
        usb: gadget: udc: core: Offload usb_udc_vbus_handler processing
        usb: typec: Fix fast_role_swap_current show function
        usb: typec: ucsi: Fix command cancellation
        USB: dwc3: fix use-after-free on core driver unbind
        USB: dwc3: qcom: fix NULL-deref on suspend
        usb: dwc3: gadget: Reset num TRBs before giving back the request
        usb: gadget: udc: renesas_usb3: Fix RZ/V2M {modprobe,bind} error
        USB: serial: option: add Quectel EM061KGL series
        thunderbolt: Mask ring interrupt on Intel hardware as well
        thunderbolt: Do not touch CL state configuration during discovery
        thunderbolt: Increase DisplayPort Connection Manager handshake timeout
        thunderbolt: dma_test: Use correct value for absent rings when creating paths
      670062e7
    • Linus Torvalds's avatar
      Merge tag 'tty-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 3c0eb442
      Linus Torvalds authored
      Pull serial driver fixes from Greg KH:
       "Here are two small serial driver fixes for 6.4-rc7 that resolve some
        reported problems:
      
         - lantiq serial driver irq fix
      
         - fsl_lpuart serial driver watermark fix
      
        Both of these have been in linux-next this week with no reported issues"
      
      * tag 'tty-6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        tty: serial: fsl_lpuart: reduce RX watermark to 0 on LS1028A
        serial: lantiq: add missing interrupt ack
      3c0eb442
  5. Jun 17, 2023
    • Ben Hutchings's avatar
      parisc: Delete redundant register definitions in <asm/assembly.h> · b5b2a02b
      Ben Hutchings authored
      
      
      We define sp and ipsw in <asm/asmregs.h> using ".reg", and when using
      current binutils (snapshot 2.40.50.20230611) the definitions in
      <asm/assembly.h> using "=" conflict with those:
      
      arch/parisc/include/asm/assembly.h: Assembler messages:
      arch/parisc/include/asm/assembly.h:93: Error: symbol `sp' is already defined
      arch/parisc/include/asm/assembly.h:95: Error: symbol `ipsw' is already defined
      
      Delete the duplicate definitions in <asm/assembly.h>.
      
      Also delete the definition of gp, which isn't used anywhere.
      
      Signed-off-by: default avatarBen Hutchings <benh@debian.org>
      Cc: stable@vger.kernel.org # v6.0+
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      b5b2a02b
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · c6cf6be9
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A handful of clk driver fixes:
      
         - Fix an OOB issue in the Mediatek mt8365 driver where arrays of clks
           are mismatched in size
      
         - Use the proper clk_ops for a few clks in the Mediatek mt8365 driver
      
         - Stop using abs() in clk_composite_determine_rate() because 64-bit
           math goes wrong on large unsigned long numbers that are subtracted
           and passed into abs()
      
         - Zero initialize a struct clk_init_data in clk-loongson2 to avoid
           stack junk confusing clk_hw_register()
      
         - Actually use a pointer to __iomem for writel() in
           pxa3xx_clk_update_accr() so we don't oops"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: pxa: fix NULL pointer dereference in pxa3xx_clk_update_accr
        clk: clk-loongson2: Zero init clk_init_data
        clk: mediatek: mt8365: Fix inverted topclk operations
        clk: composite: Fix handling of high clock rates
        clk: mediatek: mt8365: Fix index issue
      c6cf6be9