[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: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC PATCH V2 4/6] target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64 |
Date: |
Tue, 1 Apr 2014 13:13:52 +0100 |
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.)
thanks
-- PMM
- [Qemu-devel] [RFC PATCH V2 0/6] PSCI v0.2 support for KVM ARM/ARM64, Pranavkumar Sawargaonkar, 2014/04/01
- [Qemu-devel] [RFC PATCH V2 1/6] linux-headers: Update KVM headers from v3.14, Pranavkumar Sawargaonkar, 2014/04/01
- [Qemu-devel] [RFC PATCH V2 2/6] kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT, Pranavkumar Sawargaonkar, 2014/04/01
- [Qemu-devel] [RFC PATCH V2 3/6] target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible, Pranavkumar Sawargaonkar, 2014/04/01
- [Qemu-devel] [RFC PATCH V2 4/6] target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64, Pranavkumar Sawargaonkar, 2014/04/01
- Re: [Qemu-devel] [RFC PATCH V2 4/6] target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64,
Peter Maydell <=
- [Qemu-devel] [RFC PATCH V2 5/6] target-arm: Provide PSCI v0.2 constants to generic QEMU code, Pranavkumar Sawargaonkar, 2014/04/01
- [Qemu-devel] [RFC PATCH V2 6/6] hw/arm/virt: Use PSCI v0.2 function IDs when kernel supports its, Pranavkumar Sawargaonkar, 2014/04/01