1. 06 Jul, 2023 1 commit
  2. 03 Jul, 2023 3 commits
    • Huacai Chen's avatar
      MIPS: Loongson: Fix build error when make modules_install · 531b3d11
      Huacai Chen authored
      After commit 0e96ea5c ("MIPS: Loongson64: Clean up use of
      cc-ifversion") we get a build error when make modules_install:
      
      cc1: error: '-mloongson-mmi' must be used with '-mhard-float'
      
      The reason is when make modules_install, 'call cc-option' doesn't work
      in $(KBUILD_CFLAGS) of 'CHECKFLAGS'. Then there is no -mno-loongson-mmi
      applied and -march=loongson3a enable MMI instructions.
      
      To be detail, the error message comes from the CHECKFLAGS invocation of
      $(CC) but it has no impact on the final result of make modules_install,
      it is purely a cosmetic issue. The error occurs because cc-option is
      defined in scripts/Makefile.compiler, which is not included in Makefile
      when running 'make modules_install', as install targets are not supposed
      to require the compiler; see commit 805b2e1d ("kbuild: include
      Makefile.compiler only when compiler is needed"). As a result, the call
      to check for '-mno-loongson-mmi' just never happens.
      
      Fix this by partially reverting to the old logic, use 'call cc-option'
      to conditionally apply -march=loongson3a and -march=mips64r2.
      
      By the way, Loongson-2E/2F is also broken in commit 13ceb48b
      ("MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls") so fix it
      together.
      
      Fixes: 13ceb48b ("MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls")
      Fixes: 0e96ea5c ("MIPS: Loongson64: Clean up use of cc-ifversion")
      Cc: stable@vger.kernel.org
      Cc: Feiyang Chen <chenfeiyang@loongson.cn>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      531b3d11
    • Huacai Chen's avatar
      MIPS: KVM: Fix NULL pointer dereference · e4de2057
      Huacai Chen authored
      After commit 45c7e8af ("MIPS: Remove KVM_TE support") we
      get a NULL pointer dereference when creating a KVM guest:
      
      [  146.243409] Starting KVM with MIPS VZ extensions
      [  149.849151] CPU 3 Unable to handle kernel paging request at virtual address 0000000000000300, epc == ffffffffc06356ec, ra == ffffffffc063568c
      [  149.849177] Oops[#1]:
      [  149.849182] CPU: 3 PID: 2265 Comm: qemu-system-mip Not tainted 6.4.0-rc3+ #1671
      [  149.849188] Hardware name: THTF CX TL630 Series/THTF-LS3A4000-7A1000-ML4A, BIOS KL4.1F.TF.D.166.201225.R 12/25/2020
      [  149.849192] $ 0   : 0000000000000000 000000007400cce0 0000000000400004 ffffffff8119c740
      [  149.849209] $ 4   : 000000007400cce1 000000007400cce1 0000000000000000 0000000000000000
      [  149.849221] $ 8   : 000000240058bb36 ffffffff81421ac0 0000000000000000 0000000000400dc0
      [  149.849233] $12   : 9800000102a07cc8 ffffffff80e40e38 0000000000000001 0000000000400dc0
      [  149.849245] $16   : 0000000000000000 9800000106cd0000 9800000106cd0000 9800000100cce000
      [  149.849257] $20   : ffffffffc0632b28 ffffffffc05b31b0 9800000100ccca00 0000000000400000
      [  149.849269] $24   : 9800000106cd09ce ffffffff802f69d0
      [  149.849281] $28   : 9800000102a04000 9800000102a07cd0 98000001106a8000 ffffffffc063568c
      [  149.849293] Hi    : 00000335b2111e66
      [  149.849295] Lo    : 6668d90061ae0ae9
      [  149.849298] epc   : ffffffffc06356ec kvm_vz_vcpu_setup+0xc4/0x328 [kvm]
      [  149.849324] ra    : ffffffffc063568c kvm_vz_vcpu_setup+0x64/0x328 [kvm]
      [  149.849336] Status: 7400cce3 KX SX UX KERNEL EXL IE
      [  149.849351] Cause : 1000000c (ExcCode 03)
      [  149.849354] BadVA : 0000000000000300
      [  149.849357] PrId  : 0014c004 (ICT Loongson-3)
      [  149.849360] Modules linked in: kvm nfnetlink_queue nfnetlink_log nfnetlink fuse sha256_generic libsha256 cfg80211 rfkill binfmt_misc vfat fat snd_hda_codec_hdmi input_leds led_class snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core snd_pcm snd_timer snd serio_raw xhci_pci radeon drm_suballoc_helper drm_display_helper xhci_hcd ip_tables x_tables
      [  149.849432] Process qemu-system-mip (pid: 2265, threadinfo=00000000ae2982d2, task=0000000038e09ad4, tls=000000ffeba16030)
      [  149.849439] Stack : 9800000000000003 9800000100ccca00 9800000100ccc000 ffffffffc062cef4
      [  149.849453]         9800000102a07d18 c89b63a7ab338e00 0000000000000000 ffffffff811a0000
      [  149.849465]         0000000000000000 9800000106cd0000 ffffffff80e59938 98000001106a8920
      [  149.849476]         ffffffff80e57f30 ffffffffc062854c ffffffff811a0000 9800000102bf4240
      [  149.849488]         ffffffffc05b0000 ffffffff80e3a798 000000ff78000000 000000ff78000010
      [  149.849500]         0000000000000255 98000001021f7de0 98000001023f0078 ffffffff81434000
      [  149.849511]         0000000000000000 0000000000000000 9800000102ae0000 980000025e92ae28
      [  149.849523]         0000000000000000 c89b63a7ab338e00 0000000000000001 ffffffff8119dce0
      [  149.849535]         000000ff78000010 ffffffff804f3d3c 9800000102a07eb0 0000000000000255
      [  149.849546]         0000000000000000 ffffffff8049460c 000000ff78000010 0000000000000255
      [  149.849558]         ...
      [  149.849565] Call Trace:
      [  149.849567] [<ffffffffc06356ec>] kvm_vz_vcpu_setup+0xc4/0x328 [kvm]
      [  149.849586] [<ffffffffc062cef4>] kvm_arch_vcpu_create+0x184/0x228 [kvm]
      [  149.849605] [<ffffffffc062854c>] kvm_vm_ioctl+0x64c/0xf28 [kvm]
      [  149.849623] [<ffffffff805209c0>] sys_ioctl+0xc8/0x118
      [  149.849631] [<ffffffff80219eb0>] syscall_common+0x34/0x58
      
      The root cause is the deletion of kvm_mips_commpage_init() leaves vcpu
      ->arch.cop0 NULL. So fix it by making cop0 from a pointer to an embedded
      object.
      
      Fixes: 45c7e8af ("MIPS: Remove KVM_TE support")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarYu Zhao <yuzhao@google.com>
      Suggested-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      e4de2057
    • Huacai Chen's avatar
      MIPS: Loongson: Fix cpu_probe_loongson() again · 65fee014
      Huacai Chen authored
      Commit 7db5e9e9 ("MIPS: loongson64: fix FTLB configuration")
      move decode_configs() from the beginning of cpu_probe_loongson() to the
      end in order to fix FTLB configuration. However, it breaks the CPUCFG
      decoding because decode_configs() use "c->options = xxxx" rather than
      "c->options |= xxxx", all information get from CPUCFG by decode_cpucfg()
      is lost.
      
      This causes error when creating a KVM guest on Loongson-3A4000:
      Exception Code: 4 not handled @ PC: 0000000087ad5981, inst: 0xcb7a1898 BadVaddr: 0x0 Status: 0x0
      
      Fix this by moving the c->cputype setting to the beginning and moving
      decode_configs() after that.
      
      Fixes: 7db5e9e9 ("MIPS: loongson64: fix FTLB configuration")
      Cc: stable@vger.kernel.org
      Cc: Huang Pei <huangpei@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      65fee014
  3. 26 Jun, 2023 2 commits
  4. 23 Jun, 2023 11 commits
  5. 21 Jun, 2023 12 commits
  6. 20 Jun, 2023 5 commits
  7. 09 Jun, 2023 6 commits