Skip to content

Commit 44598fe

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

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

arch/loongarch/kvm/exit.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,16 @@ int kvm_emu_iocsr(larch_inst inst, struct kvm_run *run, struct kvm_vcpu *vcpu)
218218
}
219219
trace_kvm_iocsr(KVM_TRACE_IOCSR_WRITE, run->iocsr_io.len, addr, val);
220220
} else {
221+
vcpu->arch.io_gpr = rd; /* Set register id for iocsr read completion */
221222
idx = srcu_read_lock(&vcpu->kvm->srcu);
222-
ret = kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr, run->iocsr_io.len, val);
223+
ret = kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr,
224+
run->iocsr_io.len, run->iocsr_io.data);
223225
srcu_read_unlock(&vcpu->kvm->srcu, idx);
224-
if (ret == 0)
226+
if (ret == 0) {
227+
kvm_complete_iocsr_read(vcpu, run);
225228
ret = EMULATE_DONE;
226-
else {
229+
} else
227230
ret = EMULATE_DO_IOCSR;
228-
/* Save register id for iocsr read completion */
229-
vcpu->arch.io_gpr = rd;
230-
}
231231
trace_kvm_iocsr(KVM_TRACE_IOCSR_READ, run->iocsr_io.len, addr, NULL);
232232
}
233233

0 commit comments

Comments
 (0)