xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: xen-devel@lists.xenproject.org
Cc: julien.grall@citrix.com, vijaya.kumar@caviumnetworks.com,
	ian.campbell@citrix.com
Subject: [PATCH] xen/arm: Correctly read the GICv3 Re-Distributor stride
Date: Wed, 30 Sep 2015 11:54:40 +0100	[thread overview]
Message-ID: <560BBF70.7030205@huawei.com> (raw)

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@huawei.com>
---
 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

             reply	other threads:[~2015-09-30 10:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 10:54 Shameerali Kolothum Thodi [this message]
2015-09-30 11:04 ` [PATCH] xen/arm: Correctly read the GICv3 Re-Distributor stride Ian Campbell
2015-09-30 11:11   ` Julien Grall
2015-09-30 11:29   ` Shameerali Kolothum Thodi
2015-09-30 13:30     ` Ian Campbell
2015-09-30 11:06 ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560BBF70.7030205@huawei.com \
    --to=shameerali.kolothum.thodi@huawei.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=vijaya.kumar@caviumnetworks.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).