From patchwork Fri Nov 4 21:04:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9413227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D90E60573 for ; Fri, 4 Nov 2016 21:06:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FC912AD7D for ; Fri, 4 Nov 2016 21:06:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 147692AF51; Fri, 4 Nov 2016 21:06:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B2AF62AD7D for ; Fri, 4 Nov 2016 21:06:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c2lfe-0004M4-In; Fri, 04 Nov 2016 21:05:06 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c2lfd-0004Lh-FZ for xen-devel@lists.xenproject.org; Fri, 04 Nov 2016 21:05:05 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 50/ED-18083-008FC185; Fri, 04 Nov 2016 21:05:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42I5NlG2Q/f/d5k Ig9l/rC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owD368wFbRKVezobGFvYHwu0sXIxSEkMJVR 4uycVcwQznYmidvfJrN3MXJysAkYSvx9sokNxBYRUJK4t2oyUxcjBwezgLvExkNFIGFhgUCJ6 w/OgpWwCKhKrOv7C2bzCrhJPF7WxgxiSwjISZw8NpkVxOYEat387DBYjZBAO6PEz23sEDUZEv N65rBC2F4Si25cgrLVJK6e28Q8gZFvASPDKkaN4tSistQiXWMjvaSizPSMktzEzBxdQwMzvdz U4uLE9NScxKRiveT83E2MwDBhAIIdjKfXBR5ilORgUhLlfbZBJkKILyk/pTIjsTgjvqg0J7X4 EKMMB4eSBO/Kb0A5waLU9NSKtMwcYMDCpCU4eJREeP9+BUrzFhck5hZnpkOkTjHqcrzZ9fIBk xBLXn5eqpQ47w+QGQIgRRmleXAjYNFziVFWSpiXEegoIZ6C1KLczBJU+VeM4hyMSsK8nCBTeD LzSuA2vQI6ggnoCLcQsCNKEhFSUg2McjwyBccUGb22SJzsefvtl7bYM96oqWUFfjvN0yPerao O3trSY/Xkzeq4vVHuhz34XbXTZrA9C/n0PzHl+PxVKpPa2pW19sh8Leh6pvTMaGv/LofzK1e3 /vrtpnqiZB3rcW4h9x7zZdplzjmT1+rddebYx8V9vzIsNNZiwTKDjWxST/tLO2KVWIozEg21m IuKEwHmpUVbmQIAAA== X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-16.tower-27.messagelabs.com!1478293502!69515171!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28439 invoked from network); 4 Nov 2016 21:05:03 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-16.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Nov 2016 21:05:03 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8613520211; Fri, 4 Nov 2016 21:05:00 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.hsd1.ca.comcast.net (96-82-76-110-static.hfc.comcastbusiness.net [96.82.76.110]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BD6ED20219; Fri, 4 Nov 2016 21:04:58 +0000 (UTC) From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Fri, 4 Nov 2016 14:04:54 -0700 Message-Id: <1478293494-20640-2-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1478293494-20640-1-git-send-email-sstabellini@kernel.org> References: <1478293494-20640-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: julien.grall@arm.com, sstabellini@kernel.org, wei.liu2@citrix.com Subject: [Xen-devel] [PATCH v2 2/2] Partially revert 21550029f709072aacf3b90edd574e7d3021b400 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 and vsize to SZ_128K if csize is initially 4K and if PLATFORM_QUIRK_GIC_64K_STRIDE Also add a warning in case GICC is SZ_128K but not aliased. Signed-off-by: Stefano Stabellini --- Changes in v2: - only set csize to SZ_128K if it is initially SZ_4K - set vsize to match - add warning if gicc is SZ_128K and not aliased --- 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..fd2f3b4 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -965,7 +965,10 @@ static void __init gicv2_dt_init(void) printk(XENLOG_WARNING "GICv2: WARNING: " "The GICC size is too small: %#"PRIx64" expected %#x\n", csize, SZ_8K); - csize = SZ_8K; + if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) ) + vsize = csize = SZ_128K; + else + csize = SZ_8K; } /* @@ -1189,7 +1192,10 @@ static int __init gicv2_init(void) printk(XENLOG_WARNING "GICv2: Adjusting CPU interface base to %#"PRIx64"\n", cbase + aliased_offset); - } + } else if ( csize == SZ_128K ) + printk(XENLOG_WARNING + "GICv2: GICC size=%lu but not aliased\n", + csize); gicv2.map_hbase = ioremap_nocache(hbase, PAGE_SIZE); if ( !gicv2.map_hbase ) 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);