1. 12 Jul, 2022 36 commits
  2. 11 Jul, 2022 4 commits
    • Greg Kroah-Hartman's avatar
      Merge tag 'coresight-next-v5.20' of... · 7e724422
      Greg Kroah-Hartman authored
      Merge tag 'coresight-next-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux into char-misc-next
      
      Suzuki writes:
      
      CoreSight self-hosted tracing changes for v5.20.
      
       - Fixes LOCKDEP warnings on module unload with configfs
       - Conversion of DT bindings to DT schema
       - Branch broadcast support for perf cs_etm
       - Etm4x driver fixes for build failures with Clang and unrolled loops
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      
      * tag 'coresight-next-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux:
        coresight: etm4x: avoid build failure with unrolled loops
        Documentation: coresight: Expand branch broadcast documentation
        Documentation: coresight: Link config options to existing documentation
        Documentation: coresight: Turn numbered subsections into real subsections
        coresight: Add config flag to enable branch broadcast
        Documentation: coresight: Escape coresight bindings file wildcard
        dt-bindings: arm: Convert CoreSight CPU debug to DT schema
        dt-bindings: arm: Convert CoreSight bindings to DT schema
        dt-bindings: arm: Rename Coresight filenames to match compatible
        coresight: syscfg: Update load and unload operations
        coresight: configfs: Fix unload of configurations on module exit
        coresight: Clear the connection field properly
      7e724422
    • Greg Kroah-Hartman's avatar
      Merge tag 'fpga-late-for-5.20-rc1' of... · 4682f213
      Greg Kroah-Hartman authored
      Merge tag 'fpga-late-for-5.20-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga into char-misc-next
      
      Xu writes:
      
      Here is the second set of FPGA changes for 5.20-rc1
      
      FPGA Manager core:
      - Ivan's change to support image offset and data size setting for
      reprograming. A parse_header() callback is introduced for drivers to
      specify these info.
      - Colin's immediate spelling fix for Ivan's patch.
      
      Microchip:
      - Ivan's change to add Microchip MPF FPGA manager driver. And MAINTAINERS
      entry added for the driver.
      
      All patches have been reviewed on the mailing list, and have been in the
      last linux-next releases (as part of our for-next branch).
      Signed-off-by: default avatarXu Yilun <yilun.xu@intel.com>
      
      * tag 'fpga-late-for-5.20-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
        fpga: fpga-mgr: Fix spelling mistake "bitsream" -> "bitstream"
        MAINTAINERS: add Microchip PolarFire FPGA drivers entry
        dt-bindings: fpga: add binding doc for microchip-spi fpga mgr
        fpga: microchip-spi: add Microchip MPF FPGA manager
        docs: fpga: mgr: document parse_header() callback
        fpga: fpga-mgr: support bitstream offset in image buffer
      4682f213
    • Greg Kroah-Hartman's avatar
      Merge tag 'mhi-for-v5.20' of... · f5fd903b
      Greg Kroah-Hartman authored
      Merge tag 'mhi-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi into char-misc-next
      
      Manivannan writes:
      
      MHI Host
      --------
      
      Support for new modems:
      
       - Quectel EM120 FCCL based on SDX24. This product MHI configuration is same
         as EM120R-GL modem.
       - Foxconn Cinterion MV31-W. This product is same as the existing MV31-W
         modem but sold as a separate product as it uses a different firmware
         baseline.
       - Foxconn T99W175 based on SDX55.
      
      Core changes:
      
       - Moved the IRQ allocation to MHI controller registration phase. Since the
         MHI endpoint may be powered up/down several times during runtime, it
         makes sense to move the IRQ allocation to registration phase and just
         enable/disable IRQs during endpoint power up/down.
      
      MHI endpoint
      ------------
      
      Core changes:
      
       - Added error check for dev_set_name()
      
      * tag 'mhi-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi:
        bus: mhi: ep: Check dev_set_name() return value
        bus: mhi: host: pci_generic: Add another Foxconn T99W175
        bus: mhi: host: Move IRQ allocation to controller registration phase
        bus: mhi: host: pci_generic: Add Cinterion MV31-W with new baseline
        bus: mhi: host: pci_generic: Add support for Quectel EM120 FCCL modem
      f5fd903b
    • Nick Desaulniers's avatar
      coresight: etm4x: avoid build failure with unrolled loops · 4d45bc82
      Nick Desaulniers authored
      When the following configs are enabled:
      * CORESIGHT
      * CORESIGHT_SOURCE_ETM4X
      * UBSAN
      * UBSAN_TRAP
      
      Clang fails assemble the kernel with the error:
      <instantiation>:1:7: error: expected constant expression in '.inst' directive
      .inst (0xd5200000|((((2) << 19) | ((1) << 16) | (((((((((((0x160 + (i * 4))))) >> 2))) >> 7) & 0x7)) << 12) | ((((((((((0x160 + (i * 4))))) >> 2))) & 0xf)) << 8) | (((((((((((0x160 + (i * 4))))) >> 2))) >> 4) & 0x7)) << 5)))|(.L__reg_num_x8))
            ^
      drivers/hwtracing/coresight/coresight-etm4x-core.c:702:4: note: while in
      macro instantiation
      etm4x_relaxed_read32(csa, TRCCNTVRn(i));
      ^
      drivers/hwtracing/coresight/coresight-etm4x.h:403:4: note: expanded from
      macro 'etm4x_relaxed_read32'
      read_etm4x_sysreg_offset((offset), false)))
      ^
      drivers/hwtracing/coresight/coresight-etm4x.h:383:12: note: expanded
      from macro 'read_etm4x_sysreg_offset'
      __val = read_etm4x_sysreg_const_offset((offset));       \
              ^
      drivers/hwtracing/coresight/coresight-etm4x.h:149:2: note: expanded from
      macro 'read_etm4x_sysreg_const_offset'
      READ_ETM4x_REG(ETM4x_OFFSET_TO_REG(offset))
      ^
      drivers/hwtracing/coresight/coresight-etm4x.h:144:2: note: expanded from
      macro 'READ_ETM4x_REG'
      read_sysreg_s(ETM4x_REG_NUM_TO_SYSREG((reg)))
      ^
      arch/arm64/include/asm/sysreg.h:1108:15: note: expanded from macro
      'read_sysreg_s'
      asm volatile(__mrs_s("%0", r) : "=r" (__val));                  \
                   ^
      arch/arm64/include/asm/sysreg.h:1074:2: note: expanded from macro '__mrs_s'
      "       mrs_s " v ", " __stringify(r) "\n"                      \
       ^
      
      Consider the definitions of TRCSSCSRn and TRCCNTVRn:
      drivers/hwtracing/coresight/coresight-etm4x.h:56
       #define TRCCNTVRn(n)      (0x160 + (n * 4))
      drivers/hwtracing/coresight/coresight-etm4x.h:81
       #define TRCSSCSRn(n)      (0x2A0 + (n * 4))
      
      Where the macro parameter is expanded to i; a loop induction variable
      from etm4_disable_hw.
      
      When any compiler can determine that loops may be unrolled, then the
      __builtin_constant_p check in read_etm4x_sysreg_offset() defined in
      drivers/hwtracing/coresight/coresight-etm4x.h may evaluate to true. This
      can lead to the expression `(0x160 + (i * 4))` being passed to
      read_etm4x_sysreg_const_offset. Via the trace above, this is passed
      through READ_ETM4x_REG, read_sysreg_s, and finally to __mrs_s where it
      is string-ified and used directly in inline asm.
      
      Regardless of which compiler or compiler options determine whether a
      loop can or can't be unrolled, which determines whether
      __builtin_constant_p evaluates to true when passed an expression using a
      loop induction variable, it is NEVER safe to allow the preprocessor to
      construct inline asm like:
        asm volatile (".inst (0x160 + (i * 4))" : "=r"(__val));
                                       ^ expected constant expression
      
      Instead of read_etm4x_sysreg_offset() using __builtin_constant_p(), use
      __is_constexpr from include/linux/const.h instead to ensure only
      expressions that are valid integer constant expressions get passed
      through to read_sysreg_s().
      
      This is not a bug in clang; it's a potentially unsafe use of the macro
      arguments in read_etm4x_sysreg_offset dependent on __builtin_constant_p.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1310Reported-by: default avatarArnd Bergmann <arnd@kernel.org>
      Reported-by: default avatarTao Zhang <quic_taozha@quicinc.com>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20220708231520.3958391-1-ndesaulniers@google.com
      4d45bc82