diff mbox

[RFC,V5,7/8] target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64

Message ID 1399898246-4831-8-git-send-email-pranavkumar@linaro.org
State New
Headers show

Commit Message

PranavkumarSawargaonkar May 12, 2014, 12:37 p.m. UTC
To implement kvm_arch_reset_vcpu(), we simply re-init the VCPU
using kvm_arm_vcpu_init() so that all registers of VCPU are set
to their reset values by in-kernel KVM code.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
---
 target-arm/kvm64.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Peter Maydell May 14, 2014, 3:42 p.m. UTC | #1
On 12 May 2014 13:37, Pranavkumar Sawargaonkar <pranavkumar@linaro.org> wrote:
> To implement kvm_arch_reset_vcpu(), we simply re-init the VCPU
> using kvm_arm_vcpu_init() so that all registers of VCPU are set
> to their reset values by in-kernel KVM code.
>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Signed-off-by: Anup Patel <anup.patel@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 917d256..6e988f3 100644
> --- a/target-arm/kvm64.c
> +++ b/target-arm/kvm64.c
> @@ -269,4 +269,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_arm_vcpu_init(cs);
>  }

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

There is a cleanup we can make which makes this the
common reset function for both 32 and 64 bit, but let's
not tangle that up with this patchseries.

thanks
-- PMM
Diana Craciun May 15, 2014, 3:12 p.m. UTC | #2
On 05/14/2014 06:42 PM, Peter Maydell wrote:
> On 12 May 2014 13:37, Pranavkumar Sawargaonkar <pranavkumar@linaro.org> wrote:
>> To implement kvm_arch_reset_vcpu(), we simply re-init the VCPU
>> using kvm_arm_vcpu_init() so that all registers of VCPU are set
>> to their reset values by in-kernel KVM code.
>>
>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>> Signed-off-by: Anup Patel <anup.patel@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 917d256..6e988f3 100644
>> --- a/target-arm/kvm64.c
>> +++ b/target-arm/kvm64.c
>> @@ -269,4 +269,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_arm_vcpu_init(cs);
>>   }
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> There is a cleanup we can make which makes this the
> common reset function for both 32 and 64 bit, but let's
> not tangle that up with this patchseries.

It is not just cleanup, on 32 bit the reset is not working properly as 
it is currently implemented. The reason is that the secondary cores fail 
to boot because the "cpu->arch.pause" (to mark the VCPU as paused) is 
not set in KVM because the KVM_ARM_VCPU_INIT ioctl is not called on reset.

I can make the changes to re-initialize the VCPU also for 32 bit once 
these patches are final.

Diana
diff mbox

Patch

diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
index 917d256..6e988f3 100644
--- a/target-arm/kvm64.c
+++ b/target-arm/kvm64.c
@@ -269,4 +269,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_arm_vcpu_init(cs);
 }