diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2012-03-14 09:47:04 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2012-03-14 09:47:04 +0000 |
commit | 75a57b635a632d50e548be322e5f6d33e4148e2c (patch) | |
tree | e62ba4d57558fa6230ce5ce6657142ac73a44324 /xen | |
parent | df16fc180f6aa8f06be3d7b9b469df74612c57b7 (diff) | |
download | xen-75a57b635a632d50e548be322e5f6d33e4148e2c.tar.gz xen-75a57b635a632d50e548be322e5f6d33e4148e2c.tar.bz2 xen-75a57b635a632d50e548be322e5f6d33e4148e2c.zip |
arm: handle dom0_max_vcpus=0 case properly
Also use xzalloc_array.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'xen')
-rw-r--r-- | xen/arch/arm/domain_build.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 9240209351..15632f79e7 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -15,13 +15,14 @@ integer_param("dom0_max_vcpus", opt_dom0_max_vcpus); struct vcpu *__init alloc_dom0_vcpu0(void) { - dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus); + if ( opt_dom0_max_vcpus == 0 ) + opt_dom0_max_vcpus = num_online_cpus(); + if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) + opt_dom0_max_vcpus = MAX_VIRT_CPUS; + + dom0->vcpu = xzalloc_array(struct vcpu *, opt_dom0_max_vcpus); if ( !dom0->vcpu ) - { - printk("failed to alloc dom0->vccpu\n"); return NULL; - } - memset(dom0->vcpu, 0, opt_dom0_max_vcpus * sizeof(*dom0->vcpu)); dom0->max_vcpus = opt_dom0_max_vcpus; return alloc_vcpu(dom0, 0, 0); |