# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 4122e88b6c752f22a859e10cdb5f0333496b3cf5
# Parent e67432187b88ee60433779ad0f004b532ed378c8
Move idle-vcpu allocation logic to a common function.
Signed-off-by: Kevin Tian <kevin.tian@xxxxxxxxx>
---
xen/arch/ia64/linux-xen/smpboot.c | 2 +-
xen/arch/ia64/xen/xensetup.c | 2 --
xen/arch/x86/setup.c | 2 --
xen/arch/x86/smpboot.c | 14 +-------------
xen/common/domain.c | 25 +++++++++++++++++++++++++
xen/include/xen/domain.h | 1 +
6 files changed, 28 insertions(+), 18 deletions(-)
diff -r e67432187b88 -r 4122e88b6c75 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c Fri Jun 02 09:20:58 2006 +0100
+++ b/xen/arch/ia64/linux-xen/smpboot.c Fri Jun 02 09:31:35 2006 +0100
@@ -488,7 +488,7 @@ do_rest:
#else
struct vcpu *v;
- v = idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
+ v = alloc_idle_vcpu(cpu);
BUG_ON(v == NULL);
//printf ("do_boot_cpu: cpu=%d, domain=%p, vcpu=%p\n", cpu, idle, v);
diff -r e67432187b88 -r 4122e88b6c75 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c Fri Jun 02 09:20:58 2006 +0100
+++ b/xen/arch/ia64/xen/xensetup.c Fri Jun 02 09:31:35 2006 +0100
@@ -35,8 +35,6 @@ char saved_command_line[COMMAND_LINE_SIZ
char saved_command_line[COMMAND_LINE_SIZE];
char dom0_command_line[COMMAND_LINE_SIZE];
-struct vcpu *idle_vcpu[NR_CPUS];
-
cpumask_t cpu_present_map;
extern unsigned long domain0_ready;
diff -r e67432187b88 -r 4122e88b6c75 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c Fri Jun 02 09:20:58 2006 +0100
+++ b/xen/arch/x86/setup.c Fri Jun 02 09:31:35 2006 +0100
@@ -85,8 +85,6 @@ extern void early_cpu_init(void);
struct tss_struct init_tss[NR_CPUS];
-struct vcpu *idle_vcpu[NR_CPUS];
-
extern unsigned long cpu0_stack[];
struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
diff -r e67432187b88 -r 4122e88b6c75 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c Fri Jun 02 09:20:58 2006 +0100
+++ b/xen/arch/x86/smpboot.c Fri Jun 02 09:31:35 2006 +0100
@@ -887,25 +887,13 @@ static int __devinit do_boot_cpu(int api
int timeout;
unsigned long start_eip;
unsigned short nmi_high = 0, nmi_low = 0;
- struct domain *d;
struct vcpu *v;
- int vcpu_id;
++cpucount;
booting_cpu = cpu;
- if ((vcpu_id = cpu % MAX_VIRT_CPUS) == 0) {
- d = domain_create(IDLE_DOMAIN_ID, cpu);
- BUG_ON(d == NULL);
- v = d->vcpu[0];
- } else {
- d = idle_vcpu[cpu - vcpu_id]->domain;
- BUG_ON(d == NULL);
- v = alloc_vcpu(d, vcpu_id, cpu);
- }
-
- idle_vcpu[cpu] = v;
+ v = alloc_idle_vcpu(cpu);
BUG_ON(v == NULL);
v->arch.monitor_table = pagetable_from_paddr(__pa(idle_pg_table));
diff -r e67432187b88 -r 4122e88b6c75 xen/common/domain.c
--- a/xen/common/domain.c Fri Jun 02 09:20:58 2006 +0100
+++ b/xen/common/domain.c Fri Jun 02 09:31:35 2006 +0100
@@ -32,6 +32,8 @@ struct domain *domain_list;
struct domain *dom0;
+struct vcpu *idle_vcpu[NR_CPUS];
+
struct domain *alloc_domain(domid_t domid)
{
struct domain *d;
@@ -104,6 +106,29 @@ struct vcpu *alloc_vcpu(
return v;
}
+struct vcpu *alloc_idle_vcpu(unsigned int cpu_id)
+{
+ struct domain *d;
+ struct vcpu *v;
+ unsigned int vcpu_id;
+
+ if ((vcpu_id = cpu_id % MAX_VIRT_CPUS) == 0)
+ {
+ d = domain_create(IDLE_DOMAIN_ID, cpu_id);
+ BUG_ON(d == NULL);
+ v = d->vcpu[0];
+ }
+ else
+ {
+ d = idle_vcpu[cpu_id - vcpu_id]->domain;
+ BUG_ON(d == NULL);
+ v = alloc_vcpu(d, vcpu_id, cpu_id);
+ }
+
+ idle_vcpu[cpu_id] = v;
+
+ return v;
+}
struct domain *domain_create(domid_t domid, unsigned int cpu)
{
diff -r e67432187b88 -r 4122e88b6c75 xen/include/xen/domain.h
--- a/xen/include/xen/domain.h Fri Jun 02 09:20:58 2006 +0100
+++ b/xen/include/xen/domain.h Fri Jun 02 09:31:35 2006 +0100
@@ -6,6 +6,7 @@ struct vcpu *alloc_vcpu(
struct domain *d, unsigned int vcpu_id, unsigned int cpu_id);
int boot_vcpu(
struct domain *d, int vcpuid, struct vcpu_guest_context *ctxt);
+struct vcpu *alloc_idle_vcpu(unsigned int cpu_id);
struct domain *alloc_domain(domid_t domid);
void free_domain(struct domain *d);
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|