ia64/xen-unstable

changeset 13937:cc1eb0689bcf

[XEN][POWERPC] Allocate secondary VCPUs for Dom0

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Sun Jan 21 07:49:50 2007 -0500 (2007-01-21)
parents 88ae0647d542
children 7bf078335342
files xen/arch/powerpc/domain_build.c
line diff
     1.1 --- a/xen/arch/powerpc/domain_build.c	Sun Jan 21 07:47:35 2007 -0500
     1.2 +++ b/xen/arch/powerpc/domain_build.c	Sun Jan 21 07:49:50 2007 -0500
     1.3 @@ -26,6 +26,7 @@
     1.4  #include <xen/ctype.h>
     1.5  #include <xen/iocap.h>
     1.6  #include <xen/shadow.h>
     1.7 +#include <xen/domain.h>
     1.8  #include <xen/version.h>
     1.9  #include <asm/processor.h>
    1.10  #include <asm/papr.h>
    1.11 @@ -120,6 +121,7 @@ int construct_dom0(struct domain *d,
    1.12      ulong msr;
    1.13      ulong pc;
    1.14      ulong r2;
    1.15 +    int vcpu;
    1.16  
    1.17      /* Sanity! */
    1.18      BUG_ON(d->domain_id != 0);
    1.19 @@ -210,6 +212,27 @@ int construct_dom0(struct domain *d,
    1.20      /* put stack below everything */
    1.21      v->arch.ctxt.gprs[1] = dst - STACK_FRAME_OVERHEAD;
    1.22  
    1.23 +    /* startup secondary processors */
    1.24 +    if ( opt_dom0_max_vcpus == 0 )
    1.25 +        opt_dom0_max_vcpus = num_online_cpus();
    1.26 +    if ( opt_dom0_max_vcpus > num_online_cpus() )
    1.27 +        opt_dom0_max_vcpus = num_online_cpus();
    1.28 +    if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
    1.29 +        opt_dom0_max_vcpus = MAX_VIRT_CPUS;
    1.30 +#ifdef BITS_PER_GUEST_LONG
    1.31 +    if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) )
    1.32 +        opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d);
    1.33 +#endif
    1.34 +    printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
    1.35 +
    1.36 +    for (vcpu = 1; vcpu < opt_dom0_max_vcpus; vcpu++) {
    1.37 +        if (NULL == alloc_vcpu(dom0, vcpu, vcpu))
    1.38 +            panic("Error creating domain 0 vcpu %d\n", vcpu);
    1.39 +        /* for now we pin Dom0 VCPUs to their coresponding CPUs */
    1.40 +        if (cpu_isset(vcpu, cpu_online_map))
    1.41 +            dom0->vcpu[vcpu]->cpu_affinity = cpumask_of_cpu(vcpu);
    1.42 +    }
    1.43 +
    1.44      /* copy relative to Xen */
    1.45      dst += rma;
    1.46