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

[Xen-devel] Xen Dom0 boot failure on platform that supports ARM GICv4



Hi,

I am trying to boot xen(stable-4.11) on one of our ARM64 boards which
has support for GICv4.

But dom0(kernel 4.18) boot fails with the below trap,

XEN) ............done.
(XEN) Std. Loglevel: All
(XEN) Guest Loglevel: All
(XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch
input to Xen)
(XEN) Freed 304kB init memory.
(XEN) traps.c:2007:d0v0 HSR=0x93800004 pc=0xffff00000841af04
gva=0xffff00000b10ffe8 gpa=0x004000aa10ffe8

After a bit of debugging, it looks like, the GICR size used in 
vgic_v3_domain_init()
is GICv4 GICR size(256K) and this upsets the first_cpu calculations.

Since dom0 gicv3 is also an emulated one, I think the size should be
restricted to use the GICv3 GICR size(128K). I have made the below 
changes and is able to boot dom0 now.

But not sure, this is the right approach to fix the issue. Please let me
know your thoughts.

Thanks,
Shameer

---->8-------------

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index b2ed0f8..bf028cc 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1783,7 +1783,8 @@ static int __init gicv3_init(void)
     reg = readl_relaxed(GICD + GICD_TYPER);
     intid_bits = GICD_TYPE_ID_BITS(reg);
 
-    vgic_v3_setup_hw(dbase, gicv3.rdist_count, gicv3.rdist_regions, 
intid_bits);
+    vgic_v3_setup_hw(dbase, gicv3.rdist_count, gicv3.rdist_regions,
+                                intid_bits, gic_dist_supports_dvis());
     gicv3_init_v2();
 
     spin_lock_init(&gicv3.lock);
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 4b42739..0f53d88 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -59,18 +59,21 @@ static struct {
     unsigned int nr_rdist_regions;
     const struct rdist_region *regions;
     unsigned int intid_bits;  /* Number of interrupt ID bits */
+    bool dvis;
 } vgic_v3_hw;
 
 void vgic_v3_setup_hw(paddr_t dbase,
                       unsigned int nr_rdist_regions,
                       const struct rdist_region *regions,
-                      unsigned int intid_bits)
+                      unsigned int intid_bits,
+                      bool dvis)
 {
     vgic_v3_hw.enabled = true;
     vgic_v3_hw.dbase = dbase;
     vgic_v3_hw.nr_rdist_regions = nr_rdist_regions;
     vgic_v3_hw.regions = regions;
     vgic_v3_hw.intid_bits = intid_bits;
+    vgic_v3_hw.dvis = dvis;
 }
 
 static struct vcpu *vgic_v3_irouter_to_vcpu(struct domain *d, uint64_t irouter)
@@ -1673,6 +1676,9 @@ static int vgic_v3_domain_init(struct domain *d)
         {
             paddr_t size = vgic_v3_hw.regions[i].size;
 
+            if (vgic_v3_hw.dvis && (size == GICV4_GICR_SIZE))
+                 size = GICV3_GICR_SIZE;
+
             d->arch.vgic.rdist_regions[i].base = vgic_v3_hw.regions[i].base;
             d->arch.vgic.rdist_regions[i].size = size;
 
@@ -1680,6 +1686,7 @@ static int vgic_v3_domain_init(struct domain *d)
             d->arch.vgic.rdist_regions[i].first_cpu = first_cpu;
 
             first_cpu += size / GICV3_GICR_SIZE;
+
         }
 
         d->arch.vgic.intid_bits = vgic_v3_hw.intid_bits;
diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c
index a35449b..dabd5f6 100644
--- a/xen/arch/arm/vgic/vgic.c
+++ b/xen/arch/arm/vgic/vgic.c
@@ -979,7 +979,8 @@ unsigned int vgic_max_vcpus(const struct domain *d)
 void vgic_v3_setup_hw(paddr_t dbase,
                       unsigned int nr_rdist_regions,
                       const struct rdist_region *regions,
-                      unsigned int intid_bits)
+                      unsigned int intid_bits,
+                      bool dvis)
 {
     panic("New VGIC implementation does not yet support GICv3.");
 }
diff --git a/xen/include/asm-arm/gic_v3_defs.h 
b/xen/include/asm-arm/gic_v3_defs.h
index 10a2aee..de1facf 100644
--- a/xen/include/asm-arm/gic_v3_defs.h
+++ b/xen/include/asm-arm/gic_v3_defs.h
@@ -73,6 +73,8 @@
 /* Two pages for the RD_base and SGI_base register frame. */
 #define GICV3_GICR_SIZE              (2 * SZ_64K)
 
+#define GICV4_GICR_SIZE              (4 * SZ_64K)
+
 #define GICR_CTLR                    (0x0000)
 #define GICR_IIDR                    (0x0004)
 #define GICR_TYPER                   (0x0008)
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index 2a58ea3..3890ad8 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -364,7 +364,8 @@ struct rdist_region;
 void vgic_v3_setup_hw(paddr_t dbase,
                       unsigned int nr_rdist_regions,
                       const struct rdist_region *regions,
-                      unsigned int intid_bits);
+                      unsigned int intid_bits,
+                      bool dvis);
 #endif
 
 #endif /* __ASM_ARM_VGIC_H__ */


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