1. 17 Jan, 2024 20 commits
    • Hengqi Chen's avatar
      LoongArch: BPF: Prevent out-of-bounds memory access · 36a87385
      Hengqi Chen authored
      The test_tag test triggers an unhandled page fault:
      
        # ./test_tag
        [  130.640218] CPU 0 Unable to handle kernel paging request at virtual address ffff80001b898004, era == 9000000003137f7c, ra == 9000000003139e70
        [  130.640501] Oops[#3]:
        [  130.640553] CPU: 0 PID: 1326 Comm: test_tag Tainted: G      D    O       6.7.0-rc4-loong-devel-gb62ab1a397cf #47 61985c1d94084daa2432f771daa45b56b10d8d2a
        [  130.640764] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022
        [  130.640874] pc 9000000003137f7c ra 9000000003139e70 tp 9000000104cb4000 sp 9000000104cb7a40
        [  130.641001] a0 ffff80001b894000 a1 ffff80001b897ff8 a2 000000006ba210be a3 0000000000000000
        [  130.641128] a4 000000006ba210be a5 00000000000000f1 a6 00000000000000b3 a7 0000000000000000
        [  130.641256] t0 0000000000000000 t1 00000000000007f6 t2 0000000000000000 t3 9000000004091b70
        [  130.641387] t4 000000006ba210be t5 0000000000000004 t6 fffffffffffffff0 t7 90000000040913e0
        [  130.641512] t8 0000000000000005 u0 0000000000000dc0 s9 0000000000000009 s0 9000000104cb7ae0
        [  130.641641] s1 00000000000007f6 s2 0000000000000009 s3 0000000000000095 s4 0000000000000000
        [  130.641771] s5 ffff80001b894000 s6 ffff80001b897fb0 s7 9000000004090c50 s8 0000000000000000
        [  130.641900]    ra: 9000000003139e70 build_body+0x1fcc/0x4988
        [  130.642007]   ERA: 9000000003137f7c build_body+0xd8/0x4988
        [  130.642112]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
        [  130.642261]  PRMD: 00000004 (PPLV0 +PIE -PWE)
        [  130.642353]  EUEN: 00000003 (+FPE +SXE -ASXE -BTE)
        [  130.642458]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
        [  130.642554] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
        [  130.642658]  BADV: ffff80001b898004
        [  130.642719]  PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
        [  130.642815] Modules linked in: [last unloaded: bpf_testmod(O)]
        [  130.642924] Process test_tag (pid: 1326, threadinfo=00000000f7f4015f, task=000000006499f9fd)
        [  130.643062] Stack : 0000000000000000 9000000003380724 0000000000000000 0000000104cb7be8
        [  130.643213]         0000000000000000 25af8d9b6e600558 9000000106250ea0 9000000104cb7ae0
        [  130.643378]         0000000000000000 0000000000000000 9000000104cb7be8 90000000049f6000
        [  130.643538]         0000000000000090 9000000106250ea0 ffff80001b894000 ffff80001b894000
        [  130.643685]         00007ffffb917790 900000000313ca94 0000000000000000 0000000000000000
        [  130.643831]         ffff80001b894000 0000000000000ff7 0000000000000000 9000000100468000
        [  130.643983]         0000000000000000 0000000000000000 0000000000000040 25af8d9b6e600558
        [  130.644131]         0000000000000bb7 ffff80001b894048 0000000000000000 0000000000000000
        [  130.644276]         9000000104cb7be8 90000000049f6000 0000000000000090 9000000104cb7bdc
        [  130.644423]         ffff80001b894000 0000000000000000 00007ffffb917790 90000000032acfb0
        [  130.644572]         ...
        [  130.644629] Call Trace:
        [  130.644641] [<9000000003137f7c>] build_body+0xd8/0x4988
        [  130.644785] [<900000000313ca94>] bpf_int_jit_compile+0x228/0x4ec
        [  130.644891] [<90000000032acfb0>] bpf_prog_select_runtime+0x158/0x1b0
        [  130.645003] [<90000000032b3504>] bpf_prog_load+0x760/0xb44
        [  130.645089] [<90000000032b6744>] __sys_bpf+0xbb8/0x2588
        [  130.645175] [<90000000032b8388>] sys_bpf+0x20/0x2c
        [  130.645259] [<9000000003f6ab38>] do_syscall+0x7c/0x94
        [  130.645369] [<9000000003121c5c>] handle_syscall+0xbc/0x158
        [  130.645507]
        [  130.645539] Code: 380839f6  380831f9  28412bae <24000ca6> 004081ad  0014cb50  004083e8  02bff34c  58008e91
        [  130.645729]
        [  130.646418] ---[ end trace 0000000000000000 ]---
      
      On my machine, which has CONFIG_PAGE_SIZE_16KB=y, the test failed at
      loading a BPF prog with 2039 instructions:
      
        prog = (struct bpf_prog *)ffff80001b894000
        insn = (struct bpf_insn *)(prog->insnsi)ffff80001b894048
        insn + 2039 = (struct bpf_insn *)ffff80001b898000 <- end of the page
      
      In the build_insn() function, we are trying to access next instruction
      unconditionally, i.e. `(insn + 1)->imm`. The address lies in the next
      page and can be not owned by the current process, thus an page fault is
      inevitable and then segfault.
      
      So, let's access next instruction only under `dst = imm64` context.
      
      With this fix, we have:
      
        # ./test_tag
        test_tag: OK (40945 tests)
      
      Fixes: bbfddb90 ("LoongArch: BPF: Avoid declare variables in switch-case")
      Tested-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      36a87385
    • Hengqi Chen's avatar
      LoongArch: BPF: Support 64-bit pointers to kfuncs · 21c5ae5c
      Hengqi Chen authored
      Like commit 1cf3bfc6 ("bpf: Support 64-bit pointers to kfuncs")
      for s390x, add support for 64-bit pointers to kfuncs for LoongArch.
      Since the infrastructure is already implemented in BPF core, the only
      thing need to be done is to override bpf_jit_supports_far_kfunc_call().
      
      Before this change, several test_verifier tests failed:
      
        # ./test_verifier | grep # | grep FAIL
        #119/p calls: invalid kfunc call: ptr_to_mem to struct with non-scalar FAIL
        #120/p calls: invalid kfunc call: ptr_to_mem to struct with nesting depth > 4 FAIL
        #121/p calls: invalid kfunc call: ptr_to_mem to struct with FAM FAIL
        #122/p calls: invalid kfunc call: reg->type != PTR_TO_CTX FAIL
        #123/p calls: invalid kfunc call: void * not allowed in func proto without mem size arg FAIL
        #124/p calls: trigger reg2btf_ids[reg->type] for reg->type > __BPF_REG_TYPE_MAX FAIL
        #125/p calls: invalid kfunc call: reg->off must be zero when passed to release kfunc FAIL
        #126/p calls: invalid kfunc call: don't match first member type when passed to release kfunc FAIL
        #127/p calls: invalid kfunc call: PTR_TO_BTF_ID with negative offset FAIL
        #128/p calls: invalid kfunc call: PTR_TO_BTF_ID with variable offset FAIL
        #129/p calls: invalid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
        #130/p calls: valid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
        #486/p map_kptr: ref: reference state created and released on xchg FAIL
      
      This is because the kfuncs in the loaded module are far away from
      __bpf_call_base:
      
        ffff800002009440 t bpf_kfunc_call_test_fail1    [bpf_testmod]
        9000000002e128d8 T __bpf_call_base
      
      The offset relative to __bpf_call_base does NOT fit in s32, which breaks
      the assumption in BPF core. Enable bpf_jit_supports_far_kfunc_call() lifts
      this limit.
      
      Note that to reproduce the above result, tools/testing/selftests/bpf/config
      should be applied, and run the test with JIT enabled, unpriv BPF enabled.
      
      With this change, the test_verifier tests now all passed:
      
        # ./test_verifier
        ...
        Summary: 777 PASSED, 0 SKIPPED, 0 FAILED
      Tested-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      21c5ae5c
    • Tiezhu Yang's avatar
      LoongArch: Fix definition of ftrace_regs_set_instruction_pointer() · 91af17cd
      Tiezhu Yang authored
      The current definition of ftrace_regs_set_instruction_pointer() is not
      correct. Obviously, this function is used to set instruction pointer but
      not return value, so it should call instruction_pointer_set() instead of
      regs_set_return_value().
      
      There is no side effect by now because it is only used for kernel live-
      patching which is not supported, so fix it to avoid failure when testing
      livepatch in the future.
      
      Fixes: 6fbff14a ("LoongArch: ftrace: Abstract DYNAMIC_FTRACE_WITH_ARGS accesses")
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      91af17cd
    • Youling Tang's avatar
      LoongArch: Use generic interface to support crashkernel=X,[high,low] · 78de91b4
      Youling Tang authored
      LoongArch already supports two crashkernel regions in kexec-tools, so we
      can directly use the common interface to support crashkernel=X,[high,low]
      after commit 0ab97169 ("crash_core: add generic function to do
      reservation").
      
      With the help of newly changed function parse_crashkernel() and generic
      reserve_crashkernel_generic(), crashkernel reservation can be simplified
      by steps:
      
      1) Add a new header file <asm/crash_core.h>, then define CRASH_ALIGN,
         CRASH_ADDR_LOW_MAX and CRASH_ADDR_HIGH_MAX and in <asm/crash_core.h>;
      
      2) Add arch_reserve_crashkernel() to call parse_crashkernel() and
         reserve_crashkernel_generic();
      
      3) Add ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION Kconfig in
         arch/loongarch/Kconfig.
      
      One can reserve the crash kernel from high memory above DMA zone range
      by explicitly passing "crashkernel=X,high"; or reserve a memory range
      below 4G with "crashkernel=X,low". Besides, there are few rules need to
      take notice:
      
      1) "crashkernel=X,[high,low]" will be ignored if "crashkernel=size" is
         specified.
      2) "crashkernel=X,low" is valid only when "crashkernel=X,high" is passed
         and there is enough memory to be allocated under 4G.
      3) When allocating crashkernel above 4G and no "crashkernel=X,low" is
         specified, a 128M low memory will be allocated automatically for
         swiotlb bounce buffer.
      See Documentation/admin-guide/kernel-parameters.txt for more information.
      
      Following test cases have been performed as expected:
      1) crashkernel=256M                          //low=256M
      2) crashkernel=1G                            //low=1G
      3) crashkernel=4G                            //high=4G, low=128M(default)
      4) crashkernel=4G crashkernel=256M,high      //high=4G, low=128M(default), high is ignored
      5) crashkernel=4G crashkernel=256M,low       //high=4G, low=128M(default), low is ignored
      6) crashkernel=4G,high                       //high=4G, low=128M(default)
      7) crashkernel=256M,low                      //low=0M, invalid
      8) crashkernel=4G,high crashkernel=256M,low  //high=4G, low=256M
      9) crashkernel=4G,high crashkernel=4G,low    //high=0M, low=0M, invalid
      10) crashkernel=512M@2560M                   //low=512M
      11) crashkernel=1G,high crashkernel=0M,low   //high=1G, low=0M
      
      Recommended usage in general:
      1) In the case of small memory: crashkernel=512M
      2) In the case of large memory: crashkernel=1024M,high crashkernel=128M,low
      Signed-off-by: default avatarYouling Tang <tangyouling@kylinos.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      78de91b4
    • Xi Ruoyao's avatar
      LoongArch: Fix and simplify fcsr initialization on execve() · c2396651
      Xi Ruoyao authored
      There has been a lingering bug in LoongArch Linux systems causing some
      GCC tests to intermittently fail (see Closes link).  I've made a minimal
      reproducer:
      
          zsh% cat measure.s
          .align 4
          .globl _start
          _start:
              movfcsr2gr  $a0, $fcsr0
              bstrpick.w  $a0, $a0, 16, 16
              beqz        $a0, .ok
              break       0
          .ok:
              li.w        $a7, 93
              syscall     0
          zsh% cc mesaure.s -o measure -nostdlib
          zsh% echo $((1.0/3))
          0.33333333333333331
          zsh% while ./measure; do ; done
      
      This while loop should not stop as POSIX is clear that execve must set
      fenv to the default, where FCSR should be zero.  But in fact it will
      just stop after running for a while (normally less than 30 seconds).
      Note that "$((1.0/3))" is needed to reproduce this issue because it
      raises FE_INVALID and makes fcsr0 non-zero.
      
      The problem is we are currently relying on SET_PERSONALITY2() to reset
      current->thread.fpu.fcsr.  But SET_PERSONALITY2() is executed before
      start_thread which calls lose_fpu(0).  We can see if kernel preempt is
      enabled, we may switch to another thread after SET_PERSONALITY2() but
      before lose_fpu(0).  Then bad thing happens: during the thread switch
      the value of the fcsr0 register is stored into current->thread.fpu.fcsr,
      making it dirty again.
      
      The issue can be fixed by setting current->thread.fpu.fcsr after
      lose_fpu(0) because lose_fpu() clears TIF_USEDFPU, then the thread
      switch won't touch current->thread.fpu.fcsr.
      
      The only other architecture setting FCSR in SET_PERSONALITY2() is MIPS.
      I've ran a similar test on MIPS with mainline kernel and it turns out
      MIPS is buggy, too.  Anyway MIPS do this for supporting different FP
      flavors (NaN encodings, etc.) which do not exist on LoongArch.  So for
      LoongArch, we can simply remove the current->thread.fpu.fcsr setting
      from SET_PERSONALITY2() and do it in start_thread(), after lose_fpu(0).
      
      The while loop failing with the mainline kernel has survived one hour
      after this change on LoongArch.
      
      Fixes: 803b0fc5 ("LoongArch: Add process management")
      Closes: https://github.com/loongson-community/discussions/issues/7
      Link: https://lore.kernel.org/linux-mips/7a6aa1bbdbbe2e63ae96ff163fab0349f58f1b9e.camel@xry111.site/
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      c2396651
    • Huacai Chen's avatar
      LoongArch: Let cores_io_master cover the largest NR_CPUS · ce68ff35
      Huacai Chen authored
      Now loongson_system_configuration::cores_io_master only covers 64 cpus,
      if NR_CPUS > 64 there will be memory corruption. So let cores_io_master
      cover the largest NR_CPUS (256).
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ce68ff35
    • Huacai Chen's avatar
      LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE · d23b7795
      Huacai Chen authored
      LoongArch has hardware page coloring for L1 Cache, so we don't have
      cache aliases. But SFB (Store Fill Buffer) still has aliases. So we
      define SHMLBA to SZ_64K previously. But there are losts of applications
      use PAGE_SIZE rather than SHMLBA to mmap() file pages and shared pages.
      Of course we can fix them one by one, but not easy.
      
      On the other hand, we can simply disable SFB for 4KB page size to fix
      cache alias (there will be performance decrease, but acceptable), and
      in future we will fix SFB in hardware. So we can safely define SHMLBA to
      PAGE_SIZE (use the generic shmparam.h) to make life easier.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      d23b7795
    • Huacai Chen's avatar
      LoongArch: Add a missing call to efi_esrt_init() · 9499daea
      Huacai Chen authored
      ESRT (EFI System Resource Table) is needed for UEFI's "Capsule Update"
      feature. But ESRT initialization is missing on LoongArch now, so add a
      call to efi_esrt_init() at the end of efi_init().
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      9499daea
    • Binbin Zhou's avatar
      LoongArch: Parsing CPU-related information from DTS · 44a01f1f
      Binbin Zhou authored
      Generally, we can get cpu-related information, such as model name, from
      /proc/cpuinfo. For FDT-based systems, we need to parse the relevant
      information from DTS.
      
      BTW, set loongson_sysconf.cores_per_package to num_processors if SMBIOS
      doesn't provide a valid number (usually FDT-based systems).
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHongliang Wang <wanghongliang@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      44a01f1f
    • Binbin Zhou's avatar
      LoongArch: dts: DeviceTree for Loongson-2K2000 · 2905844f
      Binbin Zhou authored
      Add DeviceTree file for Loongson-2K2000 processor, which integrates two
      64-bit 3-issue superscalar LA364 processor cores.
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      2905844f
    • Binbin Zhou's avatar
      LoongArch: dts: DeviceTree for Loongson-2K1000 · 30a5532a
      Binbin Zhou authored
      Add DeviceTree file for Loongson-2K1000 processor, which integrates two
      64-bit 2-issue superscalar LA264 processor cores.
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      30a5532a
    • Binbin Zhou's avatar
      LoongArch: dts: DeviceTree for Loongson-2K0500 · 0f66569c
      Binbin Zhou authored
      Add DeviceTree file for Loongson-2K0500 processor, which integrates one
      64-bit 2-issue superscalar LA264 processor core.
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      0f66569c
    • Binbin Zhou's avatar
      LoongArch: Allow device trees be built into the kernel · 5f346a6e
      Binbin Zhou authored
      During the upstream progress of those DT-based drivers, DT properties
      are changed a lot so very different from those in existing bootloaders.
      It is inevitably that some existing systems do not provide a standard,
      canonical device tree to the kernel at boot time. So let's provide a
      device tree table in the kernel, keyed by the dts filename, containing
      the relevant DTBs.
      
      We can use the built-in dts files as references. Each SoC has only one
      built-in dts file which describes all possible device information of
      that SoC, so the dts files are good examples during development.
      
      And as a reference, our built-in dts file only enables the most basic
      bootable combinations (so it is generic enough), acts as an alternative
      in case the dts in the bootloader is unexpected.
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      5f346a6e
    • Binbin Zhou's avatar
      dt-bindings: interrupt-controller: loongson,liointc: Fix dtbs_check warning for interrupt-names · db8ce240
      Binbin Zhou authored
      The Loongson-2K0500/2K1000 CPUs have 64 interrupt sources as inputs, and
      a route-mapped node handles up to 32 interrupt sources, so two liointc
      nodes are defined in dts{i}.
      
      Of course, we have to make sure that the routing outputs ("intx") of the
      two nodes do not conflict, i.e. "int0" can only be used as a routing
      output for one of them. Therefore, "interrupt-names" should be defined
      as "pattern".
      
      In addition, since "interrupt-names" and "interrupts" are one-to-one
      correspondence, we pass it to get the corresponding interrupt number in
      the driver. Setting it to "required" does not break ABI, because it is
      already logically represented as "required".
      
      This fixes dtbs_check warning:
      
      DTC_CHK arch/loongarch/boot/dts/loongson-2k0500-ref.dtb
      arch/loongarch/boot/dts/loongson-2k0500-ref.dtb: interrupt-controller@1fe11440: interrupt-names:0: 'int0' was expected
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      arch/loongarch/boot/dts/loongson-2k0500-ref.dtb: interrupt-controller@1fe11440: Unevaluated properties are not allowed ('interrupt-names' was unexpected)
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      DTC_CHK arch/loongarch/boot/dts/loongson-2k1000-ref.dtb
      arch/loongarch/boot/dts/loongson-2k1000-ref.dtb: interrupt-controller@1fe01440: interrupt-names:0: 'int0' was expected
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      arch/loongarch/boot/dts/loongson-2k1000-ref.dtb: interrupt-controller@1fe01440: Unevaluated properties are not allowed ('interrupt-names' was unexpected)
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      Acked-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      db8ce240
    • Binbin Zhou's avatar
      dt-bindings: interrupt-controller: loongson,liointc: Fix dtbs_check warning for reg-names · aaeebb3e
      Binbin Zhou authored
      As we know, the Loongson-2K0500 is a single-core CPU, and the core1-
      related register (isr1) does not exist. So "reg" and "reg-names" should
      be set to "minItems 2"(main nad isr0).
      
      This fixes dtbs_check warning:
      
      DTC_CHK arch/loongarch/boot/dts/loongson-2k0500-ref.dtb
      arch/loongarch/boot/dts/loongson-2k0500-ref.dtb: interrupt-controller@1fe11400: reg-names: ['main', 'isr0'] is too short
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      arch/loongarch/boot/dts/loongson-2k0500-ref.dtb: interrupt-controller@1fe11400: Unevaluated properties are not allowed ('reg-names' was unexpected)
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      arch/loongarch/boot/dts/loongson-2k0500-ref.dtb: interrupt-controller@1fe11400: reg: [[0, 534844416, 0, 64], [0, 534843456, 0, 8]] is too short
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      arch/loongarch/boot/dts/loongson-2k0500-ref.dtb: interrupt-controller@1fe11440: reg-names: ['main', 'isr0'] is too short
              From schema: Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
      Acked-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      aaeebb3e
    • Binbin Zhou's avatar
      dt-bindings: loongarch: Add Loongson SoC boards compatibles · ec6b36ed
      Binbin Zhou authored
      Add Loongson SoC boards binding with DT schema format using json-schema.
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ec6b36ed
    • Binbin Zhou's avatar
      dt-bindings: loongarch: Add CPU bindings for LoongArch · 8e07e0e3
      Binbin Zhou authored
      Add the available CPUs in LoongArch binding with DT schema format using
      json-schema.
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Signed-off-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      8e07e0e3
    • WANG Rui's avatar
      LoongArch: Enable initial Rust support · 90868ff9
      WANG Rui authored
      Enable initial Rust support for LoongArch.
      Tested-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarWANG Rui <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      90868ff9
    • WANG Rui's avatar
      scripts/min-tool-version.sh: Raise minimum clang version to 18.0.0 for loongarch · f58b0aba
      WANG Rui authored
      The existing mainline clang development version encounters difficulties
      compiling the LoongArch kernel module. It is anticipated that this issue
      will be resolved in the upcoming 18.0.0 release. To prevent user
      confusion arising from broken builds, it is advisable to raise the
      minimum required clang version for LoongArch to 18.0.0.
      Suggested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Link: https://github.com/ClangBuiltLinux/linux/issues/1941Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarWANG Rui <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      f58b0aba
    • WANG Xuerui's avatar
      modpost: Ignore relaxation and alignment marker relocs on LoongArch · 2772ae4d
      WANG Xuerui authored
      With recent trunk versions of binutils and gcc, alignment directives are
      represented with R_LARCH_ALIGN relocs on LoongArch, which is necessary
      for the linker to maintain alignment requirements during its relaxation
      passes. And even though the kernel is built with relaxation disabled, so
      far a small number of R_LARCH_RELAX marker relocs are still emitted as
      part of la.* pseudo instructions in assembly. These two kinds of relocs
      do not refer to symbols, which can trip up modpost's section mismatch
      checks, because the r_offset of said relocs can be zero or any other
      meaningless value, eventually leading to a `from == NULL` condition in
      default_mismatch_handler and SIGSEGV.
      
      As the two kinds of relocs are not concerned with symbols, just ignore
      them for section mismatch check purposes.
      Signed-off-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      2772ae4d
  2. 07 Jan, 2024 1 commit
  3. 06 Jan, 2024 2 commits
  4. 05 Jan, 2024 17 commits