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

[Xen-devel] [PATCH] xen/arm: Correctly read the GICv3 Re-Distributor stride



The GICv3 driver read a 32 bit value for the re-distributor stride, but
the dts binding is a two-cell property.

All instances of rdist stride access and reference has been modified to
accommodate 64 bit value. The changes are compiled and verified on HiSilicon
Hip05 platform.

Signed-off-by: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@xxxxxxxxxx>
---
 xen/arch/arm/gic-v3.c        | 9 +++++----
 xen/arch/arm/vgic-v3.c       | 8 ++++----
 xen/include/asm-arm/domain.h | 2 +-
 xen/include/asm-arm/vgic.h   | 2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index d1db1ce..8003cd6 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -46,7 +46,7 @@
 static struct {
     void __iomem *map_dbase;  /* Mapped address of distributor registers */
     struct rdist_region *rdist_regions;
-    uint32_t  rdist_stride;
+    uint64_t rdist_stride;
     unsigned int rdist_count; /* Number of rdist regions count */
     unsigned int nr_priorities;
     spinlock_t lock;
@@ -1074,7 +1074,7 @@ static int gicv3_make_hwdom_dt_node(const struct domain 
*d,
     if ( res )
         return res;

-    res = fdt_property_cell(fdt, "redistributor-stride",
+    res = fdt_property_u64(fdt, "redistributor-stride",
                             d->arch.vgic.rdist_stride);
     if ( res )
         return res;
@@ -1224,7 +1224,8 @@ static int __init gicv3_init(void)
     /* The vGIC code requires the region to be sorted */
     sort(rdist_regs, gicv3.rdist_count, sizeof(*rdist_regs), cmp_rdist, NULL);

-    if ( !dt_property_read_u32(node, "redistributor-stride", 
&gicv3.rdist_stride) )
+    if ( !dt_property_read_u64(node, "redistributor-stride",
+                &gicv3.rdist_stride) )
         gicv3.rdist_stride = 0;

     gicv3.rdist_regions= rdist_regs;
@@ -1248,7 +1249,7 @@ static int __init gicv3_init(void)
     printk("GICv3 initialization:\n"
            "      gic_dist_addr=%#"PRIpaddr"\n"
            "      gic_maintenance_irq=%u\n"
-           "      gic_rdist_stride=%#x\n"
+           "      gic_rdist_stride=%#lx\n"
            "      gic_rdist_regions=%d\n",
            dbase, gicv3_info.maintenance_irq,
            gicv3.rdist_stride, gicv3.rdist_count);
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index f1c482d..91442c7 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -56,13 +56,13 @@ static struct {
     /* Re-distributor regions */
     unsigned int nr_rdist_regions;
     const struct rdist_region *regions;
-    uint32_t rdist_stride; /* Re-distributor stride */
+    uint64_t rdist_stride; /* Re-distributor stride */
 } vgic_v3_hw;

 void vgic_v3_setup_hw(paddr_t dbase,
                       unsigned int nr_rdist_regions,
                       const struct rdist_region *regions,
-                      uint32_t rdist_stride)
+                      uint64_t rdist_stride)
 {
     vgic_v3_hw.enabled = 1;
     vgic_v3_hw.dbase = dbase;
@@ -598,7 +598,7 @@ static inline struct vcpu *get_vcpu_from_rdist(paddr_t gpa,
                                                uint32_t *offset)
 {
     struct domain *d = v->domain;
-    uint32_t stride = d->arch.vgic.rdist_stride;
+    uint64_t stride = d->arch.vgic.rdist_stride;
     paddr_t base;
     int i, vcpu_id;
     struct vgic_rdist_region *region;
@@ -1084,7 +1084,7 @@ static int vgic_v3_vcpu_init(struct vcpu *v)

     /* Convenient alias */
     struct domain *d = v->domain;
-    uint32_t rdist_stride = d->arch.vgic.rdist_stride;
+    uint64_t rdist_stride = d->arch.vgic.rdist_stride;

     /* For SGI and PPI the target is always this CPU */
     affinity = (MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 3) << 32 |
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index c3f5a95..6d5acff 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -111,7 +111,7 @@ struct arch_domain
             unsigned int first_cpu;         /* First CPU handled */
         } rdist_regions[MAX_RDIST_COUNT];
         int nr_regions;                     /* Number of rdist regions */
-        uint32_t rdist_stride;              /* Re-Distributor stride */
+        uint64_t rdist_stride;              /* Re-Distributor stride */
 #endif
     } vgic;

diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index 41cadb1..dcaeeab 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -243,7 +243,7 @@ struct rdist_region;
 void vgic_v3_setup_hw(paddr_t dbase,
                       unsigned int nr_rdist_regions,
                       const struct rdist_region *regions,
-                      uint32_t rdist_stride);
+                      uint64_t rdist_stride);
 #endif

 #endif /* __ASM_ARM_VGIC_H__ */
-- 
1.9.1



_______________________________________________
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®.