[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 2/6] xen/arm: make processor a per cpu variable



There can be processors of different kinds on a single system. Make
processor a per_cpu variable pointing to the right processor type for
each core.

Suggested-by: Julien Grall <julien.grall@xxxxxxx>
Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

---
Changes in v2:
- add patch
---
 xen/arch/arm/processor.c | 8 ++++----
 xen/arch/arm/smpboot.c   | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/processor.c b/xen/arch/arm/processor.c
index 8c425ce..ce43850 100644
--- a/xen/arch/arm/processor.c
+++ b/xen/arch/arm/processor.c
@@ -18,7 +18,7 @@
  */
 #include <asm/procinfo.h>
 
-static const struct processor *processor = NULL;
+static DEFINE_PER_CPU(struct processor *, processor);
 
 void __init processor_setup(void)
 {
@@ -28,15 +28,15 @@ void __init processor_setup(void)
     if ( !procinfo )
         return;
 
-    processor = procinfo->processor;
+    this_cpu(processor) = procinfo->processor;
 }
 
 void processor_vcpu_initialise(struct vcpu *v)
 {
-    if ( !processor || !processor->vcpu_initialise )
+    if ( !this_cpu(processor) || !this_cpu(processor)->vcpu_initialise )
         return;
 
-    processor->vcpu_initialise(v);
+    this_cpu(processor)->vcpu_initialise(v);
 }
 
 /*
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 7ea4e41..122c0b5 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -32,6 +32,7 @@
 #include <xen/console.h>
 #include <asm/cpuerrata.h>
 #include <asm/gic.h>
+#include <asm/procinfo.h>
 #include <asm/psci.h>
 #include <asm/acpi.h>
 
@@ -300,6 +301,7 @@ void start_secondary(unsigned long boot_phys_offset,
     set_processor_id(cpuid);
 
     identify_cpu(&current_cpu_data);
+    processor_setup();
 
     init_traps();
 
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.