Re: [Qemu-devel] PSCI with mach-virt

2013-10-23 Thread Giridhar Maruthy
Hi Peter,

I did compare with kvmtool and found that the below fix boots SMP in
mach-virt with qemu.

diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index b92e00d..28b8e2b 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -82,6 +82,7 @@ int kvm_arch_init_vcpu(CPUState *cs)

 init.target = KVM_ARM_TARGET_CORTEX_A15;
 memset(init.features, 0, sizeof(init.features));
+init.features[0] = (!!(kvm_arch_vcpu_id(cs))  KVM_ARM_VCPU_POWER_OFF);
 ret = kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, init);
 if (ret) {
 return ret;


Thanks,
Giridhar


On 22 October 2013 10:00, Giridhar Maruthy giridhar.maru...@linaro.org wrote:
 Thanks Peter, I will look into it.

 Giridhar

 On 21 October 2013 19:26, Peter Maydell peter.mayd...@linaro.org wrote:
 On 21 October 2013 14:47, Giridhar Maruthy giridhar.maru...@linaro.org 
 wrote:
 Hi,

 I am using mach-virt in qemu on a kvm enabled host.

 With 2 cpus, the guest fails to boot the second processor. Following
 is the message.
 CPU1: failed to boot: -22(-EINVAL)

 The PSCI device nodes are anyway passed from virt.c file.
 Is there anything extra that needs to be done to get 2 cpus working?

 In theory it should work (it works for kvmtool and there is code
 to support it in the qemu patches). However I haven't tested it
 and it's quite possible it got accidentally broken in the course
 of the various rebasings and rewritings the mach-virt patches
 have gone through. Feel free to debug it :-)

 thanks
 -- PMM



Re: [Qemu-devel] PSCI with mach-virt

2013-10-23 Thread Peter Maydell
On 23 October 2013 07:28, Giridhar Maruthy giridhar.maru...@linaro.org wrote:
 I did compare with kvmtool and found that the below fix boots SMP in
 mach-virt with qemu.

 diff --git a/target-arm/kvm.c b/target-arm/kvm.c
 index b92e00d..28b8e2b 100644
 --- a/target-arm/kvm.c
 +++ b/target-arm/kvm.c
 @@ -82,6 +82,7 @@ int kvm_arch_init_vcpu(CPUState *cs)

  init.target = KVM_ARM_TARGET_CORTEX_A15;
  memset(init.features, 0, sizeof(init.features));
 +init.features[0] = (!!(kvm_arch_vcpu_id(cs))  KVM_ARM_VCPU_POWER_OFF);
  ret = kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, init);
  if (ret) {
  return ret;

Thanks for looking into this. We probably need to tweak this
a bit because the feature bit is only valid if the kernel supports
the KVM_ARM_CAP_PSCI capability, and we only want to do
this if we're using mach-virt rather than vexpress-a15, but we
certainly need to do something to set the start powered down
feature for CPUs after zero if we're using PSCI.

-- PMM



[Qemu-devel] PSCI with mach-virt

2013-10-21 Thread Giridhar Maruthy
Hi,

I am using mach-virt in qemu on a kvm enabled host.

With 2 cpus, the guest fails to boot the second processor. Following
is the message.
CPU1: failed to boot: -22(-EINVAL)

The PSCI device nodes are anyway passed from virt.c file.
Is there anything extra that needs to be done to get 2 cpus working?

Thanks,
Giridhar



Re: [Qemu-devel] PSCI with mach-virt

2013-10-21 Thread Peter Maydell
On 21 October 2013 14:47, Giridhar Maruthy giridhar.maru...@linaro.org wrote:
 Hi,

 I am using mach-virt in qemu on a kvm enabled host.

 With 2 cpus, the guest fails to boot the second processor. Following
 is the message.
 CPU1: failed to boot: -22(-EINVAL)

 The PSCI device nodes are anyway passed from virt.c file.
 Is there anything extra that needs to be done to get 2 cpus working?

In theory it should work (it works for kvmtool and there is code
to support it in the qemu patches). However I haven't tested it
and it's quite possible it got accidentally broken in the course
of the various rebasings and rewritings the mach-virt patches
have gone through. Feel free to debug it :-)

thanks
-- PMM



Re: [Qemu-devel] PSCI with mach-virt

2013-10-21 Thread Giridhar Maruthy
Thanks Peter, I will look into it.

Giridhar

On 21 October 2013 19:26, Peter Maydell peter.mayd...@linaro.org wrote:
 On 21 October 2013 14:47, Giridhar Maruthy giridhar.maru...@linaro.org 
 wrote:
 Hi,

 I am using mach-virt in qemu on a kvm enabled host.

 With 2 cpus, the guest fails to boot the second processor. Following
 is the message.
 CPU1: failed to boot: -22(-EINVAL)

 The PSCI device nodes are anyway passed from virt.c file.
 Is there anything extra that needs to be done to get 2 cpus working?

 In theory it should work (it works for kvmtool and there is code
 to support it in the qemu patches). However I haven't tested it
 and it's quite possible it got accidentally broken in the course
 of the various rebasings and rewritings the mach-virt patches
 have gone through. Feel free to debug it :-)

 thanks
 -- PMM