On 1 April 2014 12:53, Pranavkumar Sawargaonkar <pranavku...@linaro.org> wrote: > To implement kvm_arch_reset_vcpu(), we simply re-init the VCPU > using kvm_arch_init_vcpu() so that all registers of VCPU are set > to their reset values by in-kernel KVM code. > > Signed-off-by: Pranavkumar Sawargaonkar <pranavku...@linaro.org> > Signed-off-by: Anup Patel <anup.pa...@linaro.org> > --- > target-arm/kvm64.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c > index 02bba45..97defa3 100644 > --- a/target-arm/kvm64.c > +++ b/target-arm/kvm64.c > @@ -204,4 +204,8 @@ int kvm_arch_get_registers(CPUState *cs) > > void kvm_arch_reset_vcpu(CPUState *cs) > { > + /* Re-init VCPU so that all registers are set to their > + * respective reset values. > + */ > + kvm_arch_init_vcpu(cs); > }
Calling kvm_arch_init_vcpu() will end up doing more work than we really need, because it will end up filling in the cpreg tuple list [code not yet present for 64 bit but you can see from the 32 bit kvm_arch_init_vcpu() what it will look like]. So we should have a QEMU function for doing the vcpu init. I think I would suggest adding a uint32_t kvm_target_features to ARMCPU (under kvm_target). Then kvm_arch_init_vcpu and kvm_arch_reset_vcpu can both call a small function which does int kvm_arm_reinit_vcpu(CPUState *cs) { struct kvm_vcpu_init init; init.target = cpu->kvm_target; memset(init.features, 0, sizeof(init.features)); init.features[0] = cpu->kvm_target_features; return kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, &init); } (put that in target-arm/kvm.c, prototype in target-arm/kvm_arm.h, needs a proper doc comment in the .h file.) thanks -- PMM