Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'loongarch-fixes-6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson

Pull LoongArch fixes from Huacai Chen:
"Fix bugs about EFI screen info, hugetlb pte clear and Lockdep-RCU
splat in KVM, plus some trival cleanups"

* tag 'loongarch-fixes-6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
LoongArch: KVM: Protect kvm_io_bus_{read,write}() with SRCU
LoongArch: KVM: Protect kvm_check_requests() with SRCU
LoongArch: BPF: Adjust the parameter of emit_jirl()
LoongArch: Add architecture specific huge_pte_clear()
LoongArch/irq: Use seq_put_decimal_ull_width() for decimal values
LoongArch: Fix reserving screen info memory for above-4G firmware

+56 -19
+10
arch/loongarch/include/asm/hugetlb.h
··· 24 24 return 0; 25 25 } 26 26 27 + #define __HAVE_ARCH_HUGE_PTE_CLEAR 28 + static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, 29 + pte_t *ptep, unsigned long sz) 30 + { 31 + pte_t clear; 32 + 33 + pte_val(clear) = (unsigned long)invalid_pte_table; 34 + set_pte_at(mm, addr, ptep, clear); 35 + } 36 + 27 37 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR 28 38 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, 29 39 unsigned long addr, pte_t *ptep)
+11 -1
arch/loongarch/include/asm/inst.h
··· 683 683 DEF_EMIT_REG2I16_FORMAT(bge, bge_op) 684 684 DEF_EMIT_REG2I16_FORMAT(bltu, bltu_op) 685 685 DEF_EMIT_REG2I16_FORMAT(bgeu, bgeu_op) 686 - DEF_EMIT_REG2I16_FORMAT(jirl, jirl_op) 686 + 687 + static inline void emit_jirl(union loongarch_instruction *insn, 688 + enum loongarch_gpr rd, 689 + enum loongarch_gpr rj, 690 + int offset) 691 + { 692 + insn->reg2i16_format.opcode = jirl_op; 693 + insn->reg2i16_format.immediate = offset; 694 + insn->reg2i16_format.rd = rd; 695 + insn->reg2i16_format.rj = rj; 696 + } 687 697 688 698 #define DEF_EMIT_REG2BSTRD_FORMAT(NAME, OP) \ 689 699 static inline void emit_##NAME(union loongarch_instruction *insn, \
+1 -1
arch/loongarch/kernel/efi.c
··· 95 95 memset(si, 0, sizeof(*si)); 96 96 early_memunmap(si, sizeof(*si)); 97 97 98 - memblock_reserve(screen_info.lfb_base, screen_info.lfb_size); 98 + memblock_reserve(__screen_info_lfb_base(&screen_info), screen_info.lfb_size); 99 99 } 100 100 101 101 void __init efi_init(void)
+1 -1
arch/loongarch/kernel/inst.c
··· 332 332 return INSN_BREAK; 333 333 } 334 334 335 - emit_jirl(&insn, rj, rd, imm >> 2); 335 + emit_jirl(&insn, rd, rj, imm >> 2); 336 336 337 337 return insn.word; 338 338 }
+1 -1
arch/loongarch/kernel/smp.c
··· 82 82 for (i = 0; i < NR_IPI; i++) { 83 83 seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, prec >= 4 ? " " : ""); 84 84 for_each_online_cpu(cpu) 85 - seq_printf(p, "%10u ", per_cpu(irq_stat, cpu).ipi_irqs[i]); 85 + seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, cpu).ipi_irqs[i], 10); 86 86 seq_printf(p, " LoongArch %d %s\n", i + 1, ipi_types[i]); 87 87 } 88 88 }
+21 -10
arch/loongarch/kvm/exit.c
··· 156 156 157 157 int kvm_emu_iocsr(larch_inst inst, struct kvm_run *run, struct kvm_vcpu *vcpu) 158 158 { 159 - int ret; 159 + int idx, ret; 160 160 unsigned long *val; 161 161 u32 addr, rd, rj, opcode; 162 162 ··· 167 167 rj = inst.reg2_format.rj; 168 168 opcode = inst.reg2_format.opcode; 169 169 addr = vcpu->arch.gprs[rj]; 170 - ret = EMULATE_DO_IOCSR; 171 170 run->iocsr_io.phys_addr = addr; 172 171 run->iocsr_io.is_write = 0; 173 172 val = &vcpu->arch.gprs[rd]; ··· 206 207 } 207 208 208 209 if (run->iocsr_io.is_write) { 209 - if (!kvm_io_bus_write(vcpu, KVM_IOCSR_BUS, addr, run->iocsr_io.len, val)) 210 + idx = srcu_read_lock(&vcpu->kvm->srcu); 211 + ret = kvm_io_bus_write(vcpu, KVM_IOCSR_BUS, addr, run->iocsr_io.len, val); 212 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 213 + if (ret == 0) 210 214 ret = EMULATE_DONE; 211 - else 215 + else { 216 + ret = EMULATE_DO_IOCSR; 212 217 /* Save data and let user space to write it */ 213 218 memcpy(run->iocsr_io.data, val, run->iocsr_io.len); 214 - 219 + } 215 220 trace_kvm_iocsr(KVM_TRACE_IOCSR_WRITE, run->iocsr_io.len, addr, val); 216 221 } else { 217 - if (!kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr, run->iocsr_io.len, val)) 222 + idx = srcu_read_lock(&vcpu->kvm->srcu); 223 + ret = kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr, run->iocsr_io.len, val); 224 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 225 + if (ret == 0) 218 226 ret = EMULATE_DONE; 219 - else 227 + else { 228 + ret = EMULATE_DO_IOCSR; 220 229 /* Save register id for iocsr read completion */ 221 230 vcpu->arch.io_gpr = rd; 222 - 231 + } 223 232 trace_kvm_iocsr(KVM_TRACE_IOCSR_READ, run->iocsr_io.len, addr, NULL); 224 233 } 225 234 ··· 366 359 367 360 int kvm_emu_mmio_read(struct kvm_vcpu *vcpu, larch_inst inst) 368 361 { 369 - int ret; 362 + int idx, ret; 370 363 unsigned int op8, opcode, rd; 371 364 struct kvm_run *run = vcpu->run; 372 365 ··· 471 464 * it need not return to user space to handle the mmio 472 465 * exception. 473 466 */ 467 + idx = srcu_read_lock(&vcpu->kvm->srcu); 474 468 ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, vcpu->arch.badv, 475 469 run->mmio.len, &vcpu->arch.gprs[rd]); 470 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 476 471 if (!ret) { 477 472 update_pc(&vcpu->arch); 478 473 vcpu->mmio_needed = 0; ··· 540 531 541 532 int kvm_emu_mmio_write(struct kvm_vcpu *vcpu, larch_inst inst) 542 533 { 543 - int ret; 534 + int idx, ret; 544 535 unsigned int rd, op8, opcode; 545 536 unsigned long curr_pc, rd_val = 0; 546 537 struct kvm_run *run = vcpu->run; ··· 640 631 * it need not return to user space to handle the mmio 641 632 * exception. 642 633 */ 634 + idx = srcu_read_lock(&vcpu->kvm->srcu); 643 635 ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, vcpu->arch.badv, run->mmio.len, data); 636 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 644 637 if (!ret) 645 638 return EMULATE_DONE; 646 639
+5 -1
arch/loongarch/kvm/intc/ipi.c
··· 98 98 99 99 static int send_ipi_data(struct kvm_vcpu *vcpu, gpa_t addr, uint64_t data) 100 100 { 101 - int i, ret; 101 + int i, idx, ret; 102 102 uint32_t val = 0, mask = 0; 103 103 104 104 /* ··· 107 107 */ 108 108 if ((data >> 27) & 0xf) { 109 109 /* Read the old val */ 110 + idx = srcu_read_lock(&vcpu->kvm->srcu); 110 111 ret = kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr, sizeof(val), &val); 112 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 111 113 if (unlikely(ret)) { 112 114 kvm_err("%s: : read date from addr %llx failed\n", __func__, addr); 113 115 return ret; ··· 123 121 val &= mask; 124 122 } 125 123 val |= ((uint32_t)(data >> 32) & ~mask); 124 + idx = srcu_read_lock(&vcpu->kvm->srcu); 126 125 ret = kvm_io_bus_write(vcpu, KVM_IOCSR_BUS, addr, sizeof(val), &val); 126 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 127 127 if (unlikely(ret)) 128 128 kvm_err("%s: : write date to addr %llx failed\n", __func__, addr); 129 129
+3 -1
arch/loongarch/kvm/vcpu.c
··· 240 240 */ 241 241 static int kvm_enter_guest_check(struct kvm_vcpu *vcpu) 242 242 { 243 - int ret; 243 + int idx, ret; 244 244 245 245 /* 246 246 * Check conditions before entering the guest ··· 249 249 if (ret < 0) 250 250 return ret; 251 251 252 + idx = srcu_read_lock(&vcpu->kvm->srcu); 252 253 ret = kvm_check_requests(vcpu); 254 + srcu_read_unlock(&vcpu->kvm->srcu, idx); 253 255 254 256 return ret; 255 257 }
+3 -3
arch/loongarch/net/bpf_jit.c
··· 181 181 /* Set return value */ 182 182 emit_insn(ctx, addiw, LOONGARCH_GPR_A0, regmap[BPF_REG_0], 0); 183 183 /* Return to the caller */ 184 - emit_insn(ctx, jirl, LOONGARCH_GPR_RA, LOONGARCH_GPR_ZERO, 0); 184 + emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_RA, 0); 185 185 } else { 186 186 /* 187 187 * Call the next bpf prog and skip the first instruction 188 188 * of TCC initialization. 189 189 */ 190 - emit_insn(ctx, jirl, LOONGARCH_GPR_T3, LOONGARCH_GPR_ZERO, 1); 190 + emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_T3, 1); 191 191 } 192 192 } 193 193 ··· 904 904 return ret; 905 905 906 906 move_addr(ctx, t1, func_addr); 907 - emit_insn(ctx, jirl, t1, LOONGARCH_GPR_RA, 0); 907 + emit_insn(ctx, jirl, LOONGARCH_GPR_RA, t1, 0); 908 908 move_reg(ctx, regmap[BPF_REG_0], LOONGARCH_GPR_A0); 909 909 break; 910 910