Skip to contentSkip to conversation

arm: implement xen init code

PATCH In review Jae-Min Ryu 1 participant 1 message Feb 13, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 4/14 arm: implement xen init code

arm: implement xen init code

 xen/arch/arm/xen/cpu.c   |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 xen/arch/arm/xen/setup.c |  101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 167 insertions(+), 18 deletions(-)
xen/arch/arm/xen/cpu.c +76 -8
diff -r fb0815ba40a1 xen/arch/arm/xen/cpu.c
@@ -28,6 +28,11 @@
 #include <xen/sched.h>
 #include <xen/preempt.h>
 #include <xen/percpu.h>
+#include <asm/mmu.h>
+#include <asm/current.h>
+#include <asm/delay.h>
+#include <asm/processor.h>
+#include <asm/delay.h>
 
 cpumask_t cpu_online_map;
 cpumask_t cpu_present_map;
@@ -46,7 +51,12 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t
 
 int __cpu_up(unsigned int cpu)
 {
-	NOT_YET();
+	int ret = 0;
+
+	while(!cpu_online(cpu)) {
+		cpu_relax();
+		process_pending_softirqs();
+	}
 
 	return 0;
 }
@@ -63,35 +73,93 @@ void __cpu_die(unsigned int cpu)
 
 void set_cpu_sibling_map(unsigned int cpu)
 {
-	NOT_YET();
+	unsigned int i;
+
+	for_each_present_cpu(i) {
+		cpumask_set_cpu(i, &per_cpu(cpu_sibling_mask, cpu));
+		cpumask_set_cpu(cpu, &per_cpu(cpu_sibling_mask, i));
+
+		cpumask_set_cpu(i, &per_cpu(cpu_core_mask, cpu));
+		cpumask_set_cpu(cpu, &per_cpu(cpu_core_mask, i));
+	}
 }
 
 void smp_prepare_cpus(unsigned int max_cpus)
 {
-	NOT_YET();
+	set_cpu_sibling_map(0);
 }
 
 void smp_prepare_boot_cpu(void)
 {
-	NOT_YET();
+	int cpu = smp_processor_id();
+
+	cpumask_set_cpu(cpu, &cpu_online_map);
+	cpumask_set_cpu(cpu, &cpu_present_map);
+	cpumask_set_cpu(cpu, &cpu_possible_map);
+
+	cpu_info_init(get_cpu_info());
 }
 
 asmlinkage void start_xen_on_slave_cpu(void)
 {
-	NOT_YET();
+	unsigned int cpu;
+	struct vcpu *v;	
+
+	cpu = smp_processor_id();
+
+        /* idle vcpu is allocated by scheduler_init() */
+        v = idle_vcpu[cpu];
+	set_current(idle_vcpu[cpu]);
+
+	set_cpu_sibling_map(cpu);
+
+	notify_cpu_starting(cpu);
+	wmb();
+
+	cpumask_set_cpu(cpu, &cpu_online_map);
+	wmb();
+
+	local_irq_enable();
+	local_fiq_enable();
+
+	startup_cpu_idle_loop();
 }
 
 void smp_send_event_check_mask(const cpumask_t *mask)
 {
-	NOT_YET();
+	int cpu;
+	unsigned long map = 0;
+
+	for_each_cpu(cpu, mask) {
+		map |= 1 << cpu;
+	}
+
+	/* Trigger remote CPU */
 }
 
 void smp_call_function(void (*f)(void *param), void *param, int wait)
 {
-	NOT_YET();
 }
 
 void smp_send_state_dump(unsigned int cpu)
 {
-	NOT_YET();
 }
+
+void cpu_topology_init(unsigned int cpus)
+{
+	int i;
+
+	if (cpus == 0) {
+		cpus = 1;
+	}
+
+	if (cpus > MAX_PHYS_CPUS) {
+		cpus = MAX_PHYS_CPUS;
+	}
+
+	for (i = 0; i < cpus; i++) {
+		cpumask_set_cpu(i, &cpu_possible_map);
+		cpumask_set_cpu(i, &cpu_present_map);
+	}
+}
+
xen/arch/arm/xen/setup.c +91 -10

126 lines not on this page · raw message

arm: implement xen init code

 xen/arch/arm/xen/cpu.c   |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 xen/arch/arm/xen/setup.c |  101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 167 insertions(+), 18 deletions(-)
xen/arch/arm/xen/cpu.c +76 -8

124 lines not on this page · raw message

xen/arch/arm/xen/setup.c +91 -10

126 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel