# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5ae96e117af2dccd599de6d3c794ca82fd8df94a
# Parent ed7888c838ad5cd213a24d21ae294b31a2500f4d
Fixed ia64 compilation issues and also change xen/ia64 to use one single,
multi-cpu, idle domain created dynamically correspondingly. Only
difference is vcpu0 of idle domain is still built at compilation phase,
due to some code copied from Linux requiring that.
Signed-off-by Kevin Tian <Kevin.tian@xxxxxxxxx>
diff -r ed7888c838ad -r 5ae96e117af2 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c Tue Jan 10 17:53:44 2006
+++ b/xen/arch/ia64/linux-xen/smpboot.c Wed Jan 11 10:09:17 2006
@@ -482,9 +482,8 @@
struct vcpu *v;
void *stack;
- if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL )
- panic("failed 'createdomain' for CPU %d", cpu);
- v = idle->vcpu[0];
+ v = idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
+ BUG_ON(v == NULL);
printf ("do_boot_cpu: cpu=%d, domain=%p, vcpu=%p\n", cpu, idle, v);
diff -r ed7888c838ad -r 5ae96e117af2 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c Tue Jan 10 17:53:44 2006
+++ b/xen/arch/ia64/xen/domain.c Wed Jan 11 10:09:17 2006
@@ -87,7 +87,6 @@
int cpu = smp_processor_id();
for ( ; ; )
{
- printf ("idle%dD\n", cpu);
#ifdef IA64
// __IRQ_STAT(cpu, idle_timestamp) = jiffies
#else
@@ -146,15 +145,26 @@
{
struct vcpu *v;
+ /* Still keep idle vcpu0 static allocated at compilation, due
+ * to some code from Linux still requires it in early phase.
+ */
+ if (is_idle_domain(d) && !vcpu_id)
+ return idle_vcpu[0];
+
if ((v = alloc_xenheap_pages(KERNEL_STACK_SIZE_ORDER)) == NULL)
return NULL;
memset(v, 0, sizeof(*v));
- memcpy(&v->arch, &idle0_vcpu.arch, sizeof(v->arch));
- v->arch.privregs =
+ memcpy(&v->arch, &idle_vcpu[0]->arch, sizeof(v->arch));
+
+ if (!is_idle_domain(d)) {
+ v->arch.privregs =
alloc_xenheap_pages(get_order(sizeof(mapped_regs_t)));
+ BUG_ON(v->arch.privregs == NULL);
+ memset(v->arch.privregs, 0, PAGE_SIZE);
+ }
+
printf("arch_vcpu_info=%p\n", v->arch.privregs);
- memset(v->arch.privregs, 0, PAGE_SIZE);
return v;
}
@@ -191,6 +201,14 @@
memset(ti, 0, sizeof(struct thread_info));
init_switch_stack(v);
+ // the following will eventually need to be negotiated dynamically
+ d->xen_vastart = XEN_START_ADDR;
+ d->xen_vaend = XEN_END_ADDR;
+ d->shared_info_va = SHAREDINFO_ADDR;
+
+ if (is_idle_vcpu(v))
+ return 0;
+
d->shared_info = (void *)alloc_xenheap_page();
if (!d->shared_info) {
printk("ERROR/HALTING: CAN'T ALLOC PAGE\n");
@@ -200,12 +218,7 @@
if (v == d->vcpu[0])
memset(&d->shared_info->evtchn_mask[0], 0xff,
sizeof(d->shared_info->evtchn_mask));
-#if 0
- d->vcpu[0].arch.privregs =
- alloc_xenheap_pages(get_order(sizeof(mapped_regs_t)));
- printf("arch_vcpu_info=%p\n", d->vcpu[0].arch.privregs);
- memset(d->vcpu.arch.privregs, 0, PAGE_SIZE);
-#endif
+
v->vcpu_info = &(d->shared_info->vcpu_info[0]);
d->max_pages = (128UL*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
@@ -227,28 +240,21 @@
BUG();
v->arch.starting_rid = d->arch.starting_rid;
v->arch.ending_rid = d->arch.ending_rid;
- // the following will eventually need to be negotiated dynamically
- d->xen_vastart = XEN_START_ADDR;
- d->xen_vaend = XEN_END_ADDR;
- d->shared_info_va = SHAREDINFO_ADDR;
d->arch.breakimm = 0x1000;
v->arch.breakimm = d->arch.breakimm;
d->arch.sys_pgnr = 0;
- if (d->domain_id != IDLE_DOMAIN_ID) {
- d->arch.mm = xmalloc(struct mm_struct);
- if (unlikely(!d->arch.mm)) {
- printk("Can't allocate mm_struct for domain
%d\n",d->domain_id);
- return -ENOMEM;
- }
- memset(d->arch.mm, 0, sizeof(*d->arch.mm));
- d->arch.mm->pgd = pgd_alloc(d->arch.mm);
- if (unlikely(!d->arch.mm->pgd)) {
- printk("Can't allocate pgd for domain
%d\n",d->domain_id);
- return -ENOMEM;
- }
- } else
- d->arch.mm = NULL;
+ d->arch.mm = xmalloc(struct mm_struct);
+ if (unlikely(!d->arch.mm)) {
+ printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
+ return -ENOMEM;
+ }
+ memset(d->arch.mm, 0, sizeof(*d->arch.mm));
+ d->arch.mm->pgd = pgd_alloc(d->arch.mm);
+ if (unlikely(!d->arch.mm->pgd)) {
+ printk("Can't allocate pgd for domain %d\n",d->domain_id);
+ return -ENOMEM;
+ }
printf ("arch_do_create_domain: domain=%p\n", d);
return 0;
diff -r ed7888c838ad -r 5ae96e117af2 xen/arch/ia64/xen/idle0_task.c
--- a/xen/arch/ia64/xen/idle0_task.c Tue Jan 10 17:53:44 2006
+++ b/xen/arch/ia64/xen/idle0_task.c Wed Jan 11 10:09:17 2006
@@ -11,29 +11,14 @@
.mmlist = LIST_HEAD_INIT(name.mmlist), \
}
-#define IDLE0_EXEC_DOMAIN(_ed,_d) \
+#define IDLE_VCPU(_v) \
{ \
processor: 0, \
- mm: 0, \
- thread: INIT_THREAD, \
- domain: (_d) \
-}
-
-#define IDLE0_DOMAIN(_t) \
-{ \
- domain_id: IDLE_DOMAIN_ID, \
- refcnt: ATOMIC_INIT(1) \
+ domain: 0 \
}
struct mm_struct init_mm = INIT_MM(init_mm);
EXPORT_SYMBOL(init_mm);
-
-struct domain idle0_domain = IDLE0_DOMAIN(idle0_domain);
-#if 0
-struct vcpu idle0_vcpu = IDLE0_EXEC_DOMAIN(idle0_vcpu,
- &idle0_domain);
-#endif
-
/*
* Initial task structure.
@@ -43,15 +28,12 @@
*/
union {
struct {
- struct domain task;
+ struct vcpu task;
} s;
unsigned long stack[KERNEL_STACK_SIZE/sizeof (unsigned long)];
-} init_task_mem asm ("init_task") __attribute__((section(".data.init_task")));
-// = {{
- ;
-//.task = IDLE0_EXEC_DOMAIN(init_task_mem.s.task,&idle0_domain),
-//};
-//};
+} init_task_mem asm ("init_task") __attribute__((section(".data.init_task")))
= {{
+ .task = IDLE_VCPU(init_task_mem.s.task)
+}};
EXPORT_SYMBOL(init_task);
diff -r ed7888c838ad -r 5ae96e117af2 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c Tue Jan 10 17:53:44 2006
+++ b/xen/arch/ia64/xen/xensetup.c Wed Jan 11 10:09:17 2006
@@ -26,7 +26,7 @@
char saved_command_line[COMMAND_LINE_SIZE];
-struct vcpu *idle_vcpu[NR_CPUS] = { &idle0_vcpu };
+struct vcpu *idle_vcpu[NR_CPUS];
cpumask_t cpu_present_map;
@@ -156,15 +156,11 @@
unsigned long dom0_memory_start, dom0_memory_size;
unsigned long dom0_initrd_start, dom0_initrd_size;
unsigned long initial_images_start, initial_images_end;
+ struct domain *idle_domain;
running_on_sim = is_platform_hp_ski();
/* Kernel may be relocated by EFI loader */
xen_pstart = ia64_tpa(KERNEL_START);
-
- /* Must do this early -- e.g., spinlocks rely on get_current(). */
- //set_current(&idle0_vcpu);
- ia64_r13 = (void *)&idle0_vcpu;
- idle0_vcpu.domain = &idle0_domain;
early_setup_arch(&cmdline);
@@ -281,12 +277,16 @@
(xenheap_phys_end-__pa(heap_start)) >> 20,
(xenheap_phys_end-__pa(heap_start)) >> 10);
+printk("About to call scheduler_init()\n");
+ scheduler_init();
+ idle_vcpu[0] = (struct vcpu*) ia64_r13;
+ idle_domain = do_createdomain(IDLE_DOMAIN_ID, 0);
+ BUG_ON(idle_domain == NULL);
+
late_setup_arch(&cmdline);
setup_per_cpu_areas();
mem_init();
-printk("About to call scheduler_init()\n");
- scheduler_init();
local_irq_disable();
init_IRQ ();
printk("About to call init_xen_time()\n");
@@ -308,13 +308,9 @@
}
smp_prepare_cpus(max_cpus);
-
/* We aren't hotplug-capable yet. */
- //BUG_ON(!cpus_empty(cpu_present_map));
for_each_cpu ( i )
cpu_set(i, cpu_present_map);
-
- //BUG_ON(!local_irq_is_enabled());
/* Enable IRQ to receive IPI (needed for ITC sync). */
local_irq_enable();
@@ -344,12 +340,7 @@
/* Create initial domain 0. */
printk("About to call do_createdomain()\n");
dom0 = do_createdomain(0, 0);
- init_task.domain = &idle0_domain;
- init_task.processor = 0;
-// init_task.mm = &init_mm;
- init_task.domain->arch.mm = &init_mm;
-// init_task.thread = INIT_THREAD;
- //arch_do_createdomain(current);
+
#ifdef CLONE_DOMAIN0
{
int i;
@@ -431,8 +422,8 @@
local_irq_enable();
- printf("About to call schedulers_start dom0=%p, idle0_dom=%p\n",
- dom0, &idle0_domain);
+ printf("About to call schedulers_start dom0=%p, idle_dom=%p\n",
+ dom0, &idle_domain);
schedulers_start();
domain_unpause_by_systemcontroller(dom0);
diff -r ed7888c838ad -r 5ae96e117af2 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h Tue Jan 10 17:53:44 2006
+++ b/xen/include/asm-ia64/config.h Wed Jan 11 10:09:17 2006
@@ -141,10 +141,6 @@
#undef alloc_task_struct
#define get_thread_info(v) alloc_thread_info(v)
-// initial task has a different name in Xen
-//#define idle0_task init_task
-#define idle0_vcpu init_task
-
// avoid redefining task_t in asm/thread_info.h
#define task_t struct domain
diff -r ed7888c838ad -r 5ae96e117af2 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h Tue Jan 10 17:53:44 2006
+++ b/xen/include/public/arch-ia64.h Wed Jan 11 10:09:17 2006
@@ -9,7 +9,7 @@
/* Maximum number of virtual CPUs in multi-processor guests. */
/* WARNING: before changing this, check that shared_info fits on a page */
-#define MAX_VIRT_CPUS 1
+#define MAX_VIRT_CPUS 4
#ifndef __ASSEMBLY__
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|