mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@intel.com>
This commit is contained in:
1 parent
8aa806e0b1
commit
824e2dc244
6 files changed
+54
-80
No files matched your search
@@ -482,9 +482,8 @@ do_rest:
|
||||
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);
|
||||
|
||||
|
||||
+34
-28
@@ -87,7 +87,6 @@ static void continue_cpu_idle_loop(void)
|
||||
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 *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
|
||||
{
|
||||
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 @@ int arch_do_createdomain(struct vcpu *v)
|
||||
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 @@ int arch_do_createdomain(struct vcpu *v)
|
||||
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 @@ int arch_do_createdomain(struct vcpu *v)
|
||||
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;
|
||||
|
||||
@@ -11,30 +11,15 @@
|
||||
.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 @@ struct vcpu idle0_vcpu = IDLE0_EXEC_DOMAIN(idle0_vcpu,
|
||||
*/
|
||||
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);
|
||||
|
||||
@@ -26,7 +26,7 @@ unsigned long xenheap_phys_end;
|
||||
|
||||
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,16 +156,12 @@ void start_kernel(void)
|
||||
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);
|
||||
|
||||
/* We initialise the serial devices very early so we can get debugging. */
|
||||
@@ -281,12 +277,16 @@ void start_kernel(void)
|
||||
(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,14 +308,10 @@ printk("About to call ac_timer_init()\n");
|
||||
}
|
||||
|
||||
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 @@ printk("About to call sort_main_extable()\n");
|
||||
/* 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 @@ printk("About to call init_trace_bufs()\n");
|
||||
|
||||
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);
|
||||
|
||||
@@ -141,10 +141,6 @@ struct page;
|
||||
#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
|
||||
|
||||
|
||||
@@ -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__
|
||||
|
||||
|
||||