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

[Xen-devel] [PATCH v2 12/15] xen/arm: move GIC data to driver from domain structure



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

Move driver specific GIC address information to driver
header file gic.h from domain.h.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/domain_build.c  |    8 ++++----
 xen/arch/arm/gic-v2.c        |   28 ++++++++++++++++++----------
 xen/arch/arm/vgic-v2.c       |    6 +++---
 xen/include/asm-arm/domain.h |    5 ++---
 xen/include/asm-arm/gic.h    |    5 +++++
 5 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c9dda0e..66a98f1 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -577,12 +577,12 @@ static int make_gic_node(const struct domain *d, void 
*fdt,
 
     tmp = new_cells;
     DPRINT("  Set Distributor Base 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
-           d->arch.vgic.dbase, d->arch.vgic.dbase + PAGE_SIZE - 1);
-    dt_set_range(&tmp, node, d->arch.vgic.dbase, PAGE_SIZE);
+           d->arch.vgic.info->dbase, d->arch.vgic.info->dbase + PAGE_SIZE - 1);
+    dt_set_range(&tmp, node, d->arch.vgic.info->dbase, PAGE_SIZE);
 
     DPRINT("  Set Cpu Base 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
-           d->arch.vgic.cbase, d->arch.vgic.cbase + (PAGE_SIZE * 2) - 1);
-    dt_set_range(&tmp, node, d->arch.vgic.cbase, PAGE_SIZE * 2);
+           d->arch.vgic.info->cbase, d->arch.vgic.info->cbase + (PAGE_SIZE * 
2) - 1);
+    dt_set_range(&tmp, node, d->arch.vgic.info->cbase, PAGE_SIZE * 2);
 
     res = fdt_property(fdt, "reg", new_cells, len);
     xfree(new_cells);
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 4bcb392..6443bf4 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -413,19 +413,27 @@ static int gicv_init(struct domain *d)
 {
     int ret;
 
+    d->arch.vgic.info = xzalloc(struct vgic_info);
+    if ( !d->arch.vgic.info )
+    {
+        dprintk(XENLOG_ERR, "Failed to allocate memory for vgic_info\n");
+        return -ENOMEM;
+    }    
+    memset(d->arch.vgic.info, 0, sizeof(d->arch.vgic.info));
+
     /*
      * Domain 0 gets the hardware address.
      * Guests get the virtual platform layout.
      */
     if ( d->domain_id == 0 )
     {
-        d->arch.vgic.dbase = gic.dbase;
-        d->arch.vgic.cbase = gic.cbase;
+        d->arch.vgic.info->dbase = gic.dbase;
+        d->arch.vgic.info->cbase = gic.cbase;
     }
     else
     {
-        d->arch.vgic.dbase = GUEST_GICD_BASE;
-        d->arch.vgic.cbase = GUEST_GICC_BASE;
+        d->arch.vgic.info->dbase = GUEST_GICD_BASE;
+        d->arch.vgic.info->cbase = GUEST_GICC_BASE;
     }
 
     d->arch.vgic.nr_lines = 0;
@@ -437,19 +445,19 @@ static int gicv_init(struct domain *d)
      * The second page is always mapped at +4K irrespective of the
      * GIC_64K_STRIDE quirk. The DTB passed to the guest reflects this.
      */
-    ret = map_mmio_regions(d, d->arch.vgic.cbase,
-                           d->arch.vgic.cbase + PAGE_SIZE - 1,
+    ret = map_mmio_regions(d, d->arch.vgic.info->cbase,
+                           d->arch.vgic.info->cbase + PAGE_SIZE - 1,
                            gic.vbase);
     if ( ret )
         return ret;
 
     if ( !platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
-        ret = map_mmio_regions(d, d->arch.vgic.cbase + PAGE_SIZE,
-                               d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
+        ret = map_mmio_regions(d, d->arch.vgic.info->cbase + PAGE_SIZE,
+                               d->arch.vgic.info->cbase + (2 * PAGE_SIZE) - 1,
                                gic.vbase + PAGE_SIZE);
     else
-        ret = map_mmio_regions(d, d->arch.vgic.cbase + PAGE_SIZE,
-                               d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
+        ret = map_mmio_regions(d, d->arch.vgic.info->cbase + PAGE_SIZE,
+                               d->arch.vgic.info->cbase + (2 * PAGE_SIZE) - 1,
                                gic.vbase + 16*PAGE_SIZE);
 
     return ret;
diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index 2919665..d189f6b 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -116,7 +116,7 @@ static int vgic_distr_mmio_read(struct vcpu *v, mmio_info_t 
*info)
     struct cpu_user_regs *regs = guest_cpu_user_regs();
     register_t *r = select_user_reg(regs, dabt.reg);
     struct vgic_irq_rank *rank;
-    int offset = (int)(info->gpa - v->domain->arch.vgic.dbase);
+    int offset = (int)(info->gpa - v->domain->arch.vgic.info->dbase);
     int gicd_reg = REG(offset);
 
     switch ( gicd_reg )
@@ -378,7 +378,7 @@ static int vgic_distr_mmio_write(struct vcpu *v, 
mmio_info_t *info)
     struct cpu_user_regs *regs = guest_cpu_user_regs();
     register_t *r = select_user_reg(regs, dabt.reg);
     struct vgic_irq_rank *rank;
-    int offset = (int)(info->gpa - v->domain->arch.vgic.dbase);
+    int offset = (int)(info->gpa - v->domain->arch.vgic.info->dbase);
     int gicd_reg = REG(offset);
     uint32_t tr;
 
@@ -562,7 +562,7 @@ static int vgic_distr_mmio_check(struct vcpu *v, paddr_t 
addr)
 {
     struct domain *d = v->domain;
 
-    return (addr >= (d->arch.vgic.dbase)) && (addr < (d->arch.vgic.dbase + 
PAGE_SIZE));
+    return (addr >= (d->arch.vgic.info->dbase)) && (addr < 
(d->arch.vgic.info->dbase + PAGE_SIZE));
 }
 
 static struct mmio_handler vgic_distr_mmio_handler = {
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index c51b3cb..35d8bfa 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -148,9 +148,8 @@ struct arch_domain
          * struct arch_vcpu.
          */
         struct pending_irq *pending_irqs;
-        /* Base address for guest GIC */
-        paddr_t dbase; /* Distributor base address */
-        paddr_t cbase; /* CPU base address */
+        /* holds gic address information */
+        struct vgic_info *info;
     } vgic;
 
     struct vuart {
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 2156b55..b49dde1 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -66,6 +66,11 @@ struct vgic_irq_rank {
     uint32_t itargets[8];
 };
 
+struct vgic_info {
+    paddr_t dbase; /* Distributor base address */
+    paddr_t cbase; /* CPU base address */
+};
+
 struct gic_state_data {
     uint8_t version;
     union {
-- 
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®.