qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH V2 4/6] target-arm: Implement kvm_arch_reset


From: Pranavkumar Sawargaonkar
Subject: Re: [Qemu-devel] [RFC PATCH V2 4/6] target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64
Date: Wed, 2 Apr 2014 10:22:20 +0530

On 1 April 2014 17:43, Peter Maydell <address@hidden> wrote:
> On 1 April 2014 12:53, Pranavkumar Sawargaonkar <address@hidden> 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 <address@hidden>
>> Signed-off-by: Anup Patel <address@hidden>
>> ---
>>  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.)

Sure I will update this as per your suggestion.

>
> thanks
> -- PMM

Thanks,
Pranav



reply via email to

[Prev in Thread] Current Thread [Next in Thread]