Skip to content
  1. Oct 12, 2022
    • Tiezhu Yang's avatar
      LoongArch: Add BPF JIT support · 5dc61552
      Tiezhu Yang authored
      
      
      BPF programs are normally handled by a BPF interpreter, add BPF JIT
      support for LoongArch to allow the kernel to generate native code when
      a program is loaded into the kernel. This will significantly speed-up
      processing of BPF programs.
      
      Co-developed-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      5dc61552
    • Tiezhu Yang's avatar
      LoongArch: Add some instruction opcodes and formats · 4e59e5a4
      Tiezhu Yang authored
      
      
      According to the "Table of Instruction Encoding" in LoongArch Reference
      Manual [1], add some instruction opcodes and formats which are used in
      the BPF JIT for LoongArch.
      
      [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#table-of-instruction-encoding
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4e59e5a4
    • Tiezhu Yang's avatar
      LoongArch: Move {signed,unsigned}_imm_check() to inst.h · 8a34228e
      Tiezhu Yang authored
      
      
      {signed,unsigned}_imm_check() will also be used in the bpf jit, so move
      them from module.c to inst.h, this is preparation for later patches.
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      8a34228e
    • Youling Tang's avatar
      LoongArch: Add kdump support · 4e62d1d8
      Youling Tang authored
      
      
      This patch adds support for kdump. In kdump case the normal kernel will
      reserve a region for the crash kernel and jump there on panic.
      
      Arch-specific functions are added to allow for implementing a crash dump
      file interface, /proc/vmcore, which can be viewed as a ELF file.
      
      A user-space tool, such as kexec-tools, is responsible for allocating a
      separate region for the core's ELF header within the crash kdump kernel
      memory and filling it in when executing kexec_load().
      
      Then, its location will be advertised to the crash dump kernel via a
      command line argument "elfcorehdr=", and the crash dump kernel will
      preserve this region for later use with arch_reserve_vmcore() at boot
      time.
      
      At the same time, the crash kdump kernel is also limited within the
      "crashkernel" area via a command line argument "mem=", so as not to
      destroy the original kernel dump data.
      
      In the crash dump kernel environment, /proc/vmcore is used to access the
      primary kernel's memory with copy_oldmem_page().
      
      I tested kdump on LoongArch machines (Loongson-3A5000) and it works as
      expected (suggested crashkernel parameter is "crashkernel=512M@2560M"),
      you may test it by triggering a crash through /proc/sysrq-trigger:
      
       $ sudo kexec -p /boot/vmlinux-kdump --reuse-cmdline --append="nr_cpus=1"
       # echo c > /proc/sysrq-trigger
      
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4e62d1d8
    • Youling Tang's avatar
      LoongArch: Add kexec support · 4a03b2ac
      Youling Tang authored
      
      
      Add three new files, kexec.h, machine_kexec.c and relocate_kernel.S to
      the LoongArch architecture, so as to add support for the kexec re-boot
      mechanism (CONFIG_KEXEC) on LoongArch platforms.
      
      Kexec supports loading vmlinux.elf in ELF format and vmlinux.efi in PE
      format.
      
      I tested kexec on LoongArch machines (Loongson-3A5000) and it works as
      expected:
      
       $ sudo kexec -l /boot/vmlinux.efi --reuse-cmdline
       $ sudo kexec -e
      
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4a03b2ac
    • Youling Tang's avatar
      LoongArch: Use generic BUG() handler · 2d2c3952
      Youling Tang authored
      Inspired by commit 9fb7410f
      
      ("arm64/BUG: Use BRK instruction for
      generic BUG traps"), do similar for LoongArch to use generic BUG()
      handler.
      
      This patch uses the BREAK software breakpoint instruction to generate
      a trap instead, similarly to most other arches, with the generic BUG
      code generating the dmesg boilerplate.
      
      This allows bug metadata to be moved to a separate table and reduces
      the amount of inline code at BUG() and WARN() sites. This also avoids
      clobbering any registers before they can be dumped.
      
      To mitigate the size of the bug table further, this patch makes use of
      the existing infrastructure for encoding addresses within the bug table
      as 32-bit relative pointers instead of absolute pointers.
      
      (Note: this limits the max kernel size to 2GB.)
      
      Before patch:
      [ 3018.338013] lkdtm: Performing direct entry BUG
      [ 3018.342445] Kernel bug detected[#5]:
      [ 3018.345992] CPU: 2 PID: 865 Comm: cat Tainted: G D 6.0.0-rc6+ #35
      
      After patch:
      [  125.585985] lkdtm: Performing direct entry BUG
      [  125.590433] ------------[ cut here ]------------
      [  125.595020] kernel BUG at drivers/misc/lkdtm/bugs.c:78!
      [  125.600211] Oops - BUG[#1]:
      [  125.602980] CPU: 3 PID: 410 Comm: cat Not tainted 6.0.0-rc6+ #36
      
      Out-of-line file/line data information obtained compared to before.
      
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      2d2c3952
    • Huacai Chen's avatar
      LoongArch: Add SysRq-x (TLB Dump) support · dea2df3c
      Huacai Chen authored
      
      
      Add SysRq-x (TLB Dump) support for LoongArch, which is useful for
      debugging.
      
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      dea2df3c
    • Huacai Chen's avatar
      LoongArch: Add perf events support · b37042b2
      Huacai Chen authored
      
      
      The perf events infrastructure of LoongArch is very similar to old MIPS-
      based Loongson, so most of the codes are derived from MIPS.
      
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b37042b2
    • Huacai Chen's avatar
      LoongArch: Add qspinlock support · 5f1e001b
      Huacai Chen authored
      
      
      On NUMA system, the performance of qspinlock is better than generic
      spinlock. Below is the UnixBench test results on a 8 nodes (4 cores
      per node, 32 cores in total) machine.
      
      A. With generic spinlock:
      
      System Benchmarks Index Values               BASELINE       RESULT    INDEX
      Dhrystone 2 using register variables         116700.0  449574022.5  38523.9
      Double-Precision Whetstone                       55.0      85190.4  15489.2
      Execl Throughput                                 43.0      14696.2   3417.7
      File Copy 1024 bufsize 2000 maxblocks          3960.0     143157.8    361.5
      File Copy 256 bufsize 500 maxblocks            1655.0      37631.8    227.4
      File Copy 4096 bufsize 8000 maxblocks          5800.0     444814.2    766.9
      Pipe Throughput                               12440.0    5047490.7   4057.5
      Pipe-based Context Switching                   4000.0    2021545.7   5053.9
      Process Creation                                126.0      23829.8   1891.3
      Shell Scripts (1 concurrent)                     42.4      33756.7   7961.5
      Shell Scripts (8 concurrent)                      6.0       4062.9   6771.5
      System Call Overhead                          15000.0    2479748.6   1653.2
                                                                         ========
      System Benchmarks Index Score                                        2955.6
      
      B. With qspinlock:
      
      System Benchmarks Index Values               BASELINE       RESULT    INDEX
      Dhrystone 2 using register variables         116700.0  449467876.9  38514.8
      Double-Precision Whetstone                       55.0      85174.6  15486.3
      Execl Throughput                                 43.0      14769.1   3434.7
      File Copy 1024 bufsize 2000 maxblocks          3960.0     146150.5    369.1
      File Copy 256 bufsize 500 maxblocks            1655.0      37496.8    226.6
      File Copy 4096 bufsize 8000 maxblocks          5800.0     447527.0    771.6
      Pipe Throughput                               12440.0    5175989.2   4160.8
      Pipe-based Context Switching                   4000.0    2207747.8   5519.4
      Process Creation                                126.0      25125.5   1994.1
      Shell Scripts (1 concurrent)                     42.4      33461.2   7891.8
      Shell Scripts (8 concurrent)                      6.0       4024.7   6707.8
      System Call Overhead                          15000.0    2917278.6   1944.9
                                                                         ========
      System Benchmarks Index Score                                        3040.1
      
      Signed-off-by: default avatarRui Wang <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      5f1e001b
    • Huacai Chen's avatar
      LoongArch: Use TLB for ioremap() · d2791341
      Huacai Chen authored
      
      
      We can support more cache attributes (e.g., CC, SUC and WUC) and page
      protection when we use TLB for ioremap(). The implementation is based
      on GENERIC_IOREMAP.
      
      The existing simple ioremap() implementation has better performance so
      we keep it and introduce ARCH_IOREMAP to control the selection.
      
      We move pagetable_init() earlier to make early ioremap() works, and we
      modify the PCI ecam mapping because the TLB-based version of ioremap()
      will actually take the size into account.
      
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      d2791341
    • Huacai Chen's avatar
      LoongArch: Support access filter to /dev/mem interface · 235d074f
      Huacai Chen authored
      
      
      Accidental access to /dev/mem is obviously disastrous, but specific
      access can be used by people debugging the kernel. So select GENERIC_
      LIB_DEVMEM_IS_ALLOWED, as well as define ARCH_HAS_VALID_PHYS_ADDR_RANGE
      and related helpers, to support access filter to /dev/mem interface.
      
      Signed-off-by: default avatarWeihao Li <liweihao@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      235d074f
    • Huacai Chen's avatar
      LoongArch: Refactor cache probe and flush methods · b61a40af
      Huacai Chen authored
      
      
      Current cache probe and flush methods have some drawbacks:
      1, Assume there are 3 cache levels and only 3 levels;
      2, Assume L1 = I + D, L2 = V, L3 = S, V is exclusive, S is inclusive.
      
      However, the fact is I + D, I + D + V, I + D + S and I + D + V + S are
      all valid. So, refactor the cache probe and flush methods to adapt more
      types of cache hierarchy.
      
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b61a40af
    • Rui Wang's avatar
      LoongArch: mm: Refactor TLB exception handlers · a2a84e36
      Rui Wang authored
      
      
      This patch simplifies TLB load, store and modify exception handlers:
      
      1. Reduce instructions, such as alu/csr and memory access;
      2. Execute tlb search instruction only in the fast path;
      3. Return directly from the fast path for both normal and huge pages;
      4. Re-tab the assembly for better vertical alignment.
      
      And fixes the concurrent modification issue of fast path for huge pages.
      
      This issue will occur in the following steps:
      
         CPU-1 (In TLB exception)         CPU-2 (In THP splitting)
      1: Load PMD entry (HUGE=1)
      2: Goto huge path
      3:                                  Store PMD entry (HUGE=0)
      4: Reload PMD entry (HUGE=0)
      5: Fill TLB entry (PA is incorrect)
      
      This patch also slightly improves the TLB processing performance:
      
      * Normal pages: 2.15%, Huge pages: 1.70%.
      
        #include <stdio.h>
        #include <stdlib.h>
        #include <unistd.h>
        #include <sys/mman.h>
      
        int main(int argc, char *argv[])
        {
              size_t page_size;
              size_t mem_size;
              size_t off;
              void *base;
              int flags;
              int i;
      
              if (argc < 2) {
                      fprintf(stderr, "%s MEM_SIZE [HUGE]\n", argv[0]);
                      return -1;
              }
      
              page_size = sysconf(_SC_PAGESIZE);
              flags = MAP_PRIVATE | MAP_ANONYMOUS;
              mem_size = strtoul(argv[1], NULL, 10);
              if (argc > 2)
                      flags |= MAP_HUGETLB;
      
              for (i = 0; i < 10; i++) {
                      base = mmap(NULL, mem_size, PROT_READ, flags, -1, 0);
                      if (base == MAP_FAILED) {
                              fprintf(stderr, "Map memory failed!\n");
                              return -1;
                      }
      
                      for (off = 0; off < mem_size; off += page_size)
                              *(volatile int *)(base + off);
      
                      munmap(base, mem_size);
              }
      
              return 0;
        }
      
      Signed-off-by: default avatarRui Wang <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      a2a84e36
    • Xi Ruoyao's avatar
      LoongArch: Support R_LARCH_GOT_PC_{LO12,HI20} in modules · 59b3d4a9
      Xi Ruoyao authored
      
      
      GCC >= 13 and GNU assembler >= 2.40 use these relocations to address
      external symbols, so we need to add them.
      
      Let the module loader emit GOT entries for data symbols so we would be
      able to handle GOT relocations. The GOT entry is just the data's symbol
      address.
      
      In module.lds, emit a stub .got section for a section header entry. The
      actual content of the section entry will be filled at runtime by module_
      frob_arch_sections().
      
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      59b3d4a9
    • Xi Ruoyao's avatar
      LoongArch: Support PC-relative relocations in modules · 9bd1e380
      Xi Ruoyao authored
      
      
      Binutils >= 2.40 uses R_LARCH_B26 instead of R_LARCH_SOP_PUSH_PLT_PCREL,
      and R_LARCH_PCALA* instead of R_LARCH_SOP_PUSH_PCREL.
      
      Handle R_LARCH_B26 and R_LARCH_PCALA* in the module loader. For R_LARCH_
      B26, also create a PLT entry as needed.
      
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      9bd1e380
    • Xi Ruoyao's avatar
      LoongArch: Define ELF relocation types added in ABIv2.0 · 0a75e5d1
      Xi Ruoyao authored
      
      
      These relocation types are used by GNU binutils >= 2.40 and GCC >= 13.
      Add their definitions so we will be able to use them in later patches.
      
      Link: https://github.com/loongson/LoongArch-Documentation/pull/57
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      0a75e5d1
    • Xi Ruoyao's avatar
      LoongArch: Adjust symbol addressing for AS_HAS_EXPLICIT_RELOCS · 11cd8a64
      Xi Ruoyao authored
      
      
      If explicit relocation hints are used by the toolchain, -Wa,-mla-*
      options will be useless for the C code. So only use them for the
      !CONFIG_AS_HAS_EXPLICIT_RELOCS case.
      
      Replace "la" with "la.pcrel" in head.S to keep the semantic consistent
      with new and old toolchains for the low level startup code.
      
      For per-CPU variables, the "address" of the symbol is actually an offset
      from $r21. The value is near the loading address of main kernel image,
      but far from the loading address of modules. So we use model("extreme")
      attibute to tell the compiler that a PC-relative addressing with 32-bit
      offset is not sufficient for local per-CPU variables.
      
      The behavior with different assemblers and compilers are summarized in
      the following table:
      
      AS has            CC has
      explicit relocs   explicit relocs * Behavior
      ==============================================================
      No                No                Use la.* macros.
                                          No change from Linux 6.0.
      --------------------------------------------------------------
      No                Yes               Disable explicit relocs.
                                          No change from Linux 6.0.
      --------------------------------------------------------------
      Yes               No                Not supported.
      --------------------------------------------------------------
      Yes               Yes               Enable explicit relocs.
                                          No -Wa,-mla* options used.
      ==============================================================
      *: We assume CC must have model attribute if it has explicit relocs.
         Both features are added in GCC 13 development cycle, so any GCC
         release >= 13 should be OK. Using early GCC 13 development snapshots
         may produce modules with unsupported relocations.
      
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a
      Link: https://gcc.gnu.org/r13-1834
      Link: https://gcc.gnu.org/r13-2199
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      11cd8a64
    • Xi Ruoyao's avatar
      LoongArch: Add Kconfig option AS_HAS_EXPLICIT_RELOCS · 0d8dad70
      Xi Ruoyao authored
      
      
      GNU as >= 2.40 and GCC >= 13 will support using explicit relocation
      hints in the assembly code, instead of la.* macros. The usage of
      explicit relocation hints can improve code generation so it's enabled
      by default by GCC >= 13.
      
      Introduce a Kconfig option AS_HAS_EXPLICIT_RELOCS as the switch for
      "use explicit relocation hints or not".
      
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      0d8dad70
    • Colin Ian King's avatar
      LoongArch: Kconfig: Fix spelling mistake "delibrately" -> "deliberately" · 9550dfde
      Colin Ian King authored
      
      
      There is a spelling mistake in a commented section. Fix it.
      
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      9550dfde
    • Huacai Chen's avatar
      LoongArch: Mark __xchg() and __cmpxchg() as __always_inline · ddf50271
      Huacai Chen authored
      Commit ac7c3e4f ("compiler: enable CONFIG_OPTIMIZE_INLINING
      forcibly") allows compiler to uninline functions marked as 'inline'.
      In case of __xchg()/__cmpxchg() this would cause to reference
      BUILD_BUG(), which is an error case for catching bugs and will not
      happen for correct code, if __xchg()/__cmpxchg() is inlined.
      
      This bug can be produced with CONFIG_DEBUG_SECTION_MISMATCH enabled,
      and the solution is similar to below commits:
      46f16195 ("MIPS: include: Mark __xchg as __always_inline"),
      88356d09
      
       ("MIPS: include: Mark __cmpxchg as __always_inline").
      
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ddf50271
    • Huacai Chen's avatar
      LoongArch: Flush TLB earlier at initialization · 1299a129
      Huacai Chen authored
      
      
      Move local_flush_tlb_all() earlier (just after setup_ptwalker() and
      before page allocation). This can avoid stale TLB entries misguiding
      the later page allocation. Without this patch the second kernel of
      kexec/kdump fails to boot SMP.
      
      BTW, move output_pgtable_bits_defines() into tlb_init() since it has
      nothing to do with tlb handler setup.
      
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      1299a129
    • Tiezhu Yang's avatar
      LoongArch: Do not create sysfs control file for io master CPUs · a522b7ad
      Tiezhu Yang authored
      Now io master CPUs are not hotpluggable on LoongArch, but in the current
      code only /sys/devices/system/cpu/cpu0/online is not created. Let us set
      the hotpluggable field of all the io master CPUs as 0, then prevent to
      create sysfs control file for all the io master CPUs which confuses some
      user space tools. This is similar with commit 9cce844a
      
       ("MIPS: CPU#0
      is not hotpluggable").
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      a522b7ad
    • Jianmin Lv's avatar
      LoongArch: Fix cpu name after CPU-hotplug · 4b2edd38
      Jianmin Lv authored
      
      
      Don't overwrite the SMBIOS-provided CPU name on coming back from CPU-
      hotplug (including S3/S4) if it is already initialized.
      
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarJianmin Lv <lvjianmin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4b2edd38
  2. Oct 03, 2022
    • Huacai Chen's avatar
      Merge tag 'efi-next-for-v6.1' into loongarch-next · 1625c8cb
      Huacai Chen authored
      LoongArch architecture changes for 6.1 depend on the efi changes to
      work, so merge them to create a base.
      1625c8cb
    • Linus Torvalds's avatar
      Linux 6.0 · 4fe89d07
      Linus Torvalds authored
      v6.0
      4fe89d07
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · a962b54e
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Add missing DT bindings for STM32 and a resource leak fix for DaVinci"
      
      * tag 'i2c-for-6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe
        dt-bindings: i2c: st,stm32-i2c: Document wakeup-source property
        dt-bindings: i2c: st,stm32-i2c: Document interrupt-names property
      a962b54e
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2022-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · febae48a
      Linus Torvalds authored
      Pull misc perf fixes from Ingo Molnar:
      
       - Fix a PMU enumeration/initialization bug on Intel Alder Lake CPUs
      
       - Fix KVM guest PEBS register handling
      
       - Fix race/reentry bug in perf_output_read_group() reading of PMU
         counters
      
      * tag 'perf-urgent-2022-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Fix reentry problem in perf_output_read_group()
        perf/x86/core: Completely disable guest PEBS via guest's global_ctrl
        perf/x86/intel: Fix unchecked MSR access error for Alder Lake N
      febae48a
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 534b0abc
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - Add the respective UP last level cache mask accessors in order not to
         cause segfaults when lscpu accesses their representation in sysfs
      
       - Fix for a race in the alternatives batch patching machinery when
         kprobes are set
      
      * tag 'x86_urgent_for_v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cacheinfo: Add a cpu_llc_shared_mask() UP variant
        x86/alternative: Fix race in try_get_desc()
      534b0abc
  3. Oct 02, 2022
    • Zhang Qilong's avatar
      i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe · e2062df7
      Zhang Qilong authored
      The pm_runtime_enable will increase power disable depth. Thus a
      pairing decrement is needed on the error handling path to keep
      it balanced according to context.
      
      Fixes: 17f88151
      
       ("i2c: davinci: Add PM Runtime Support")
      Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
      Reviewed-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      e2062df7
    • Marek Vasut's avatar
      dt-bindings: i2c: st,stm32-i2c: Document wakeup-source property · 367d4c88
      Marek Vasut authored
      
      
      Document wakeup-source property. This fixes dtbs_check warnings
      when building current Linux DTs:
      
      "
      arch/arm/boot/dts/stm32mp153c-dhcom-drc02.dtb: i2c@40015000: Unevaluated properties are not allowed ('wakeup-source' was unexpected)
      "
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      367d4c88
    • Marek Vasut's avatar
      dt-bindings: i2c: st,stm32-i2c: Document interrupt-names property · f938a529
      Marek Vasut authored
      
      
      Document interrupt-names property with "event" and "error" interrupt names.
      This fixes dtbs_check warnings when building current Linux DTs:
      
      "
      arch/arm/boot/dts/stm32mp153c-dhcom-drc02.dtb: i2c@40015000: Unevaluated properties are not allowed ('interrupt-names' was unexpected)
      "
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      f938a529
    • Linus Torvalds's avatar
      Merge tag 'usb-6.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · b357fd1c
      Linus Torvalds authored
      Pull USB/Thunderbolt fixes from Greg KH:
       "Here are some tiny USB and Thunderbolt driver fixes and quirks.
      
        Included in here are:
      
         - three uas/usb-storage driver quirks to get the devices working
           properly due to broken firmware images in them (they can not run at
           high data rates, and are also throttled on other operating systems
           because of this)
      
         - thunderbolt bugfix for plug event delays
      
         - typec runtime warning removal
      
         - dwc3 st driver bugfix. Note, a follow-on fix for this will end up
           coming in for 6.1-rc1 as the developers are still arguing over what
           the final solution will be, but this should be sufficient for now
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-6.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        uas: ignore UAS for Thinkplus chips
        usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS
        uas: add no-uas quirk for Hiksemi usb_disk
        usb: dwc3: st: Fix node's child name
        usb: typec: ucsi: Remove incorrect warning
        thunderbolt: Explicitly reset plug events delay back to USB4 spec value
      b357fd1c
    • Linus Torvalds's avatar
      Merge tag 'media/v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 89f2ddce
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
      
       - some fixes for the v4l2 ioctl handler logic
      
       - a fix for an out of bound access in the DVB videobuf2 handler
      
       - three driver fixes (rkvdec, mediatek/vcodek and uvcvideo)
      
      * tag 'media/v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: rkvdec: Disable H.264 error detection
        media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
        media: dvb_vb2: fix possible out of bound access
        media: v4l2-ioctl.c: fix incorrect error path
        media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()
        media: uvcvideo: Fix InterfaceProtocol for Quanta camera
      89f2ddce
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2022-09-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm · 2a4b6e13
      Linus Torvalds authored
      Pull more hotfixes from Andrew Morton:
       "One MAINTAINERS update, two MM fixes, both cc:stable"
      
      The previous pull wasn't fated to be the last one..
      
      * tag 'mm-hotfixes-stable-2022-09-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        damon/sysfs: fix possible memleak on damon_sysfs_add_target
        mm: fix BUG splat with kvmalloc + GFP_ATOMIC
        MAINTAINERS: drop entry to removed file in ARM/RISCPC ARCHITECTURE
      2a4b6e13
  4. Oct 01, 2022
    • Levi Yun's avatar
      damon/sysfs: fix possible memleak on damon_sysfs_add_target · 1c8e2349
      Levi Yun authored
      When damon_sysfs_add_target couldn't find proper task, New allocated
      damon_target structure isn't registered yet, So, it's impossible to free
      new allocated one by damon_sysfs_destroy_targets.
      
      By calling damon_add_target as soon as allocating new target, Fix this
      possible memory leak.
      
      Link: https://lkml.kernel.org/r/20220926160611.48536-1-sj@kernel.org
      Fixes: a61ea561
      
       ("mm/damon/sysfs: link DAMON for virtual address spaces monitoring")
      Signed-off-by: default avatarLevi Yun <ppbuk5246@gmail.com>
      Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
      Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: <stable@vger.kernel.org>	[5.17.x]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      1c8e2349
    • Florian Westphal's avatar
      mm: fix BUG splat with kvmalloc + GFP_ATOMIC · 30c19366
      Florian Westphal authored
      Martin Zaharinov reports BUG with 5.19.10 kernel:
       kernel BUG at mm/vmalloc.c:2437!
       invalid opcode: 0000 [#1] SMP
       CPU: 28 PID: 0 Comm: swapper/28 Tainted: G        W  O      5.19.9 #1
       [..]
       RIP: 0010:__get_vm_area_node+0x120/0x130
        __vmalloc_node_range+0x96/0x1e0
        kvmalloc_node+0x92/0xb0
        bucket_table_alloc.isra.0+0x47/0x140
        rhashtable_try_insert+0x3a4/0x440
        rhashtable_insert_slow+0x1b/0x30
       [..]
      
      bucket_table_alloc uses kvzalloc(GPF_ATOMIC).  If kmalloc fails, this now
      falls through to vmalloc and hits code paths that assume GFP_KERNEL.
      
      Link: https://lkml.kernel.org/r/20220926151650.15293-1-fw@strlen.de
      Fixes: a421ef30
      
       ("mm: allow !GFP_KERNEL allocations for kvmalloc")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Suggested-by: default avatarMichal Hocko <mhocko@suse.com>
      Link: https://lore.kernel.org/linux-mm/Yy3MS2uhSgjF47dy@pc636/T/#t
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Reported-by: default avatarMartin Zaharinov <micron10@gmail.com>
      Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      30c19366
    • Lukas Bulwahn's avatar
      MAINTAINERS: drop entry to removed file in ARM/RISCPC ARCHITECTURE · b674dedd
      Lukas Bulwahn authored
      Commit c1fe8d05 ("ARM: riscpc: use GENERIC_IRQ_MULTI_HANDLER") removes
      arch/arm/include/asm/hardware/entry-macro-iomd.S, but missed to adjust
      MAINTAINERS.
      
      Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about a
      broken reference.
      
      Drop the file entry to the removed file in ARM/RISCPC ARCHITECTURE.
      
      Link: https://lkml.kernel.org/r/20220919075255.386-1-lukas.bulwahn@gmail.com
      Fixes: c1fe8d05
      
       ("ARM: riscpc: use GENERIC_IRQ_MULTI_HANDLER")
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Russell King <linux@armlinux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      b674dedd
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2022-10-01' of git://anongit.freedesktop.org/drm/drm · ffb4d94b
      Linus Torvalds authored
      Pull drm fixes from Daniel Vetter:
       "Some last minute amd fixes:
      
         - VCN 4.x and GC 11.x fixes, mostly around fw"
      
      * tag 'drm-fixes-2022-10-01' of git://anongit.freedesktop.org/drm/drm:
        drm/amdgpu/gfx11: switch to amdgpu_gfx_rlc_init_microcode
        drm/amdgpu: add helper to init rlc firmware
        drm/amdgpu: add helper to init rlc fw in header v2_4
        drm/amdgpu: add helper to init rlc fw in header v2_3
        drm/amdgpu: add helper to init rlc fw in header v2_2
        drm/amdgpu: add helper to init rlc fw in header v2_1
        drm/amdgpu: add helper to init rlc fw in header v2_0
        drm/amdgpu: save rlcv/rlcp ucode version in amdgpu_gfx
        drm/amdgpu: Enable sram on vcn_4_0_2
        drm/amdgpu: Enable VCN DPG for GC11_0_1
      ffb4d94b
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · e5fa173f
      Linus Torvalds authored
      Pull clk driver fixes from Stephen Boyd:
       "Here's the last batch of clk driver fixes for this release.
      
        These patches fix serious problems, for example, i.MX has an issue
        where changing the NAND clk frequency hangs the system. On Allwinner
        H6 the GPU is being overclocked which could lead to long term hardware
        damage.
      
        And finally on some Broadcom SoCs the serial console stopped working
        because the clk tree hierarchy description got broken by an
        inadvertant DT node name change. That's fixed by using
        'clock-output-names' to generate a stable and unique name for clks so
        the framework can properly link things up.
      
        There's also a couple build fixes in here. One to fix CONFIG_OF=n
        builds and one to avoid an array out of bounds bug that happens during
        clk registration on microchip. I hope that KASAN would have found that
        OOB problem, but probably KASAN wasn't attempted. Instead LLVM/clang
        compilation caused an oops, while GCC didn't"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: imx93: drop of_match_ptr
        clk: iproc: Do not rely on node name for correct PLL setup
        clk: sunxi-ng: h6: Fix default PLL GPU rate
        clk: imx: imx6sx: remove the SET_RATE_PARENT flag for QSPI clocks
        clk: microchip: mpfs: make the rtc's ahb clock critical
        clk: microchip: mpfs: fix clk_cfg array bounds violation
        clk: ingenic-tcu: Properly enable registers before accessing timers
      e5fa173f
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v6.0-2022-09-29' of... · c816f2e9
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v6.0-2022-09-29' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fail the 'perf test record' entry on error, fixing a regression where
         just setup stuff like allocating memory and not the actual things
         being tested failed.
      
       - Fixup disabling of -Wdeprecated-declarations for the python scripting
         engine, the previous attempt had a brown paper bag thinko.
      
       - Fix branch stack sampling test to include sanity check for branch
         filter on PowerPC.
      
       - Update is_ignored_symbol function to match the kernel ignored list,
         fixing running the 'perf test' entry that compares resolving symbols
         from kallsyms to resolving from vmlinux.
      
       - Augment the data source type with ARM's neoverse_spe list, the
         previous code was limited in its search resolving the data source.
      
       - Fix some clang 5 variable set but unused cases.
      
       - Get a perf cgroup more portably in BPF as the
         __builtin_preserve_enum_value builtin is not available in older
         versions of clang. In those cases we can forgo BPF's CO-RE (Compile
         Once, Run Everywhere).
      
       - More Fixes for Intel's hybrid CPU model.
      
      * tag 'perf-tools-fixes-for-v6.0-2022-09-29' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf build: Fixup disabling of -Wdeprecated-declarations for the python scripting engine
        perf tests mmap-basic: Remove unused variable to address clang 15 warning
        perf parse-events: Ignore clang 15 warning about variable set but unused in bison produced code
        perf tests record: Fail the test if the 'errs' counter is not zero
        perf test: Fix test case 87 ("perf record tests") for hybrid systems
        perf arm-spe: augment the data source type with neoverse_spe list
        perf tests vmlinux-kallsyms: Update is_ignored_symbol function to match the kernel ignored list
        perf tests powerpc: Fix branch stack sampling test to include sanity check for branch filter
        perf parse-events: Remove "not supported" hybrid cache events
        perf print-events: Fix "perf list" can not display the PMU prefix for some hybrid cache events
        perf tools: Get a perf cgroup more portably in BPF
      c816f2e9