Skip to content

Commit 80edf90

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: KVM: Add sign extension with kernel MMIO read emulation
Function kvm_complete_mmio_read() is to add sign extension with MMIO read emulation, it is used in user space MMIO read completion now. Also it should be used in kernel MMIO read emulation. Signed-off-by: Bibo Mao <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 7109f51 commit 80edf90

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

arch/loongarch/kvm/exit.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,23 +468,24 @@ int kvm_emu_mmio_read(struct kvm_vcpu *vcpu, larch_inst inst)
468468
if (ret == EMULATE_DO_MMIO) {
469469
trace_kvm_mmio(KVM_TRACE_MMIO_READ, run->mmio.len, run->mmio.phys_addr, NULL);
470470

471+
vcpu->arch.io_gpr = rd; /* Set for kvm_complete_mmio_read() use */
472+
471473
/*
472474
* If mmio device such as PCH-PIC is emulated in KVM,
473475
* it need not return to user space to handle the mmio
474476
* exception.
475477
*/
476478
idx = srcu_read_lock(&vcpu->kvm->srcu);
477479
ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, vcpu->arch.badv,
478-
run->mmio.len, &vcpu->arch.gprs[rd]);
480+
run->mmio.len, run->mmio.data);
479481
srcu_read_unlock(&vcpu->kvm->srcu, idx);
480482
if (!ret) {
483+
kvm_complete_mmio_read(vcpu, run);
481484
update_pc(&vcpu->arch);
482485
vcpu->mmio_needed = 0;
483486
return EMULATE_DONE;
484487
}
485488

486-
/* Set for kvm_complete_mmio_read() use */
487-
vcpu->arch.io_gpr = rd;
488489
run->mmio.is_write = 0;
489490
vcpu->mmio_is_write = 0;
490491
return EMULATE_DO_MMIO;

0 commit comments

Comments
 (0)