Re: [PING PATCH v4 23/29] LoongArch: KVM: Implement handle gspr exception
From: Paolo Bonzini
Date: Tue Mar 28 2023 - 10:15:28 EST
On 3/28/23 14:31, Tianrui Zhao wrote:
+ case 0xc91:
+ /* idle GSPR */
+ er = _kvm_emu_idle(vcpu);
+ break;
So this is my last remark. What some other architectures do is change
vcpu->arch.mp_state when entering an idle state, and at this point all
calls to KVM_RUN would call the equivalent of _kvm_emu_idle(). This
requires implementing the KVM_GET_MPSTATE and KVM_SET_MPSTATE ioctls.
This might also be useful if later you want to implement a mechanism
where vCPUs can pause or resume, for example for multi-vCPU VMs.
You can implement this on top of what you have, but I highly recommend
that you do it in the first version of what is committed to Linux.
Paolo