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

[Xen-devel] [PATCH v2 11/15] xen/arm: make GIC context data version specific



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>

GIC context data is dependent on hardware version
make the contents of gic context data structure
as version specific and access accordingly

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/gic-v2.c     |   15 ++++++++-------
 xen/include/asm-arm/gic.h |   11 ++++++++---
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 06ed12b..4bcb392 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -96,6 +96,7 @@ static int gic_state_init(struct vcpu *v)
      v->arch.gic_state = xzalloc(struct gic_state_data);
      if ( !v->arch.gic_state )
         return -ENOMEM;
+     v->arch.gic_state->version = 2;
      return 0;
 }
 
@@ -108,9 +109,9 @@ static void save_state(struct vcpu *v)
      * accessed simultaneously by another pCPU.
      */
     for ( i = 0; i < nr_lrs; i++ )
-        v->arch.gic_state->gic_lr[i] = GICH[GICH_LR + i];
-    v->arch.gic_state->gic_apr = GICH[GICH_APR];
-    v->arch.gic_state->gic_vmcr = GICH[GICH_VMCR];
+        v->arch.gic_state->v2.gic_lr[i] = GICH[GICH_LR + i];
+    v->arch.gic_state->v2.gic_apr = GICH[GICH_APR];
+    v->arch.gic_state->v2.gic_vmcr = GICH[GICH_VMCR];
     /* Disable until next VCPU scheduled */
     GICH[GICH_HCR] = 0;
 }
@@ -120,9 +121,9 @@ static void restore_state(struct vcpu *v)
     int i;
 
     for ( i = 0; i < nr_lrs; i++ )
-        GICH[GICH_LR + i] = v->arch.gic_state->gic_lr[i];
-    GICH[GICH_APR] = v->arch.gic_state->gic_apr;
-    GICH[GICH_VMCR] = v->arch.gic_state->gic_vmcr;
+        GICH[GICH_LR + i] = v->arch.gic_state->v2.gic_lr[i];
+    GICH[GICH_APR] = v->arch.gic_state->v2.gic_apr;
+    GICH[GICH_VMCR] = v->arch.gic_state->v2.gic_vmcr;
     GICH[GICH_HCR] = GICH_HCR_EN;
 }
 
@@ -135,7 +136,7 @@ static void gic_dump_state(struct vcpu *v)
             printk("   HW_LR[%d]=%x\n", i, GICH[GICH_LR + i]);
     } else {
         for ( i = 0; i < nr_lrs; i++ )
-            printk("   VCPU_LR[%d]=%x\n", i, v->arch.gic_state->gic_lr[i]);
+            printk("   VCPU_LR[%d]=%x\n", i, v->arch.gic_state->v2.gic_lr[i]);
     }
 }
 
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 290e821..2156b55 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -67,9 +67,14 @@ struct vgic_irq_rank {
 };
 
 struct gic_state_data {
-    uint32_t gic_hcr, gic_vmcr;
-    uint32_t gic_apr;
-    uint32_t gic_lr[64];
+    uint8_t version;
+    union {
+        struct gic_v2 {
+            uint32_t gic_hcr, gic_vmcr;
+            uint32_t gic_apr;
+            uint32_t gic_lr[64];
+        }v2;
+    };
 };
 
 struct gic_lr {
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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