xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: xen-devel@lists.xenproject.org
Cc: julien.grall@arm.com, sstabellini@kernel.org, wei.liu2@citrix.com
Subject: [PATCH 2/2] Partially revert 21550029f709072aacf3b90edd574e7d3021b400
Date: Tue, 25 Oct 2016 15:46:55 -0700	[thread overview]
Message-ID: <1477435615-28752-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1477435615-28752-1-git-send-email-sstabellini@kernel.org>

Commit 21550029f709072aacf3b90edd574e7d3021b400 removed the
PLATFORM_QUIRK_GIC_64K_STRIDE quirk and introduced a way to
automatically detect that the two GICC pages have a 64K stride.

However the heuristic requires that the device tree for the platform
reports a GICC size == 128K, which is not the case for some versions of
XGene.

Fix the issue by partially reverting
21550029f709072aacf3b90edd574e7d3021b400:

- reintroduce PLATFORM_QUIRK_GIC_64K_STRIDE for XGene
- force csize to SZ_128K for mapping if PLATFORM_QUIRK_GIC_64K_STRIDE

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/gic-v2.c                | 10 ++++++++--
 xen/arch/arm/platforms/xgene-storm.c |  6 ++++++
 xen/include/asm-arm/platform.h       |  6 ++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 9bd9d0b..2c6b8f1 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1146,6 +1146,7 @@ static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
 static int __init gicv2_init(void)
 {
     uint32_t aliased_offset = 0;
+    paddr_t csize_map;
 
     if ( acpi_disabled )
         gicv2_dt_init();
@@ -1165,15 +1166,20 @@ static int __init gicv2_init(void)
          (hbase & ~PAGE_MASK) || (vbase & ~PAGE_MASK) )
         panic("GICv2 interfaces not page aligned");
 
+    if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
+        csize_map = SZ_128K;
+    else
+        csize_map = csize;
+
     gicv2.map_dbase = ioremap_nocache(dbase, PAGE_SIZE);
     if ( !gicv2.map_dbase )
         panic("GICv2: Failed to ioremap for GIC distributor\n");
 
-    gicv2.map_cbase = ioremap_nocache(cbase, csize);
+    gicv2.map_cbase = ioremap_nocache(cbase, csize_map);
     if ( !gicv2.map_cbase )
         panic("GICv2: Failed to ioremap for GIC CPU interface\n");
 
-    if ( gicv2_is_aliased(cbase, csize) )
+    if ( gicv2_is_aliased(cbase, csize_map) )
     {
         /*
          * Move the base up by 60kB, so that we have a 8kB contiguous
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index 686b19b..c795a95 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -67,6 +67,11 @@ static void __init xgene_check_pirq_eoi(void)
               "Please upgrade your firmware to the latest version");
 }
 
+static uint32_t xgene_storm_quirks(void)
+{
+    return PLATFORM_QUIRK_GIC_64K_STRIDE;
+}
+
 static void xgene_storm_reset(void)
 {
     void __iomem *addr;
@@ -116,6 +121,7 @@ PLATFORM_START(xgene_storm, "APM X-GENE STORM")
     .compatible = xgene_storm_dt_compat,
     .init = xgene_storm_init,
     .reset = xgene_storm_reset,
+    .quirks = xgene_storm_quirks,
 PLATFORM_END
 
 /*
diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index c6e5010..2ea9d61 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -39,6 +39,12 @@ struct platform_desc {
     const struct dt_device_match *blacklist_dev;
 };
 
+/*
+ * Quirk for platforms where the 4K GIC register ranges are placed at
+ * 64K stride.
+ */
+#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 0)
+
 void __init platform_init(void);
 int __init platform_init_time(void);
 int __init platform_specific_mapping(struct domain *d);
-- 
1.9.1


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

  reply	other threads:[~2016-10-25 22:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 22:46 [PATCH 0/2] Fix Xen boot on XGene Stefano Stabellini
2016-10-25 22:46 ` [PATCH 1/2] Revert "xen/arm: platform: Drop the quirks callback" Stefano Stabellini
2016-10-25 22:46   ` Stefano Stabellini [this message]
2016-10-26 11:27     ` [PATCH 2/2] Partially revert 21550029f709072aacf3b90edd574e7d3021b400 Wei Liu
2016-10-26 11:27   ` [PATCH 1/2] Revert "xen/arm: platform: Drop the quirks callback" Wei Liu
2016-10-26 17:08 ` [PATCH 0/2] Fix Xen boot on XGene Julien Grall
2016-10-26 22:12   ` Stefano Stabellini
2016-10-31 14:05     ` Julien Grall
2016-11-01 19:29       ` Stefano Stabellini
2016-11-02 10:20         ` Julien Grall
2016-11-04 20:24           ` Stefano Stabellini

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=1477435615-28752-2-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=julien.grall@arm.com \
    --cc=wei.liu2@citrix.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).