From patchwork Tue Oct 25 22:46:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9395679 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 6406560234 for ; Tue, 25 Oct 2016 22:49:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3624F295A9 for ; Tue, 25 Oct 2016 22:49:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AE88295AB; Tue, 25 Oct 2016 22:49:31 +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 02A8B295A9 for ; Tue, 25 Oct 2016 22:49:30 +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 1bzAUs-0003AL-7C; Tue, 25 Oct 2016 22:47:06 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzAUq-00039n-E9 for xen-devel@lists.xenproject.org; Tue, 25 Oct 2016 22:47:04 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 21/69-02113-7E0EF085; Tue, 25 Oct 2016 22:47:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRWlGSWpSXmKPExsVybKJsh+7zB/w RBi2uFt+3TGZyYPQ4/OEKSwBjFGtmXlJ+RQJrxtRNfawFvVIVt+5MZW5g3CLaxcjFISQwlVGi 88Q5VghnO5NEe/8Dti5GTg42AUOJv082gdkiAkoS91ZNZupi5OBgFnCX2HioCMQUFvCTuPIrH qSCRUBV4mH/WVYQm1fATeLy9t/MILaEgJzEyWOTweKcQJ133n1mgljVxihx/O8zqKIMiXk9c1 ghbC+JRTcuQdlqElfPbWKewMi3gJFhFaN6cWpRWWqRrpleUlFmekZJbmJmjq6hgbFebmpxcWJ 6ak5iUrFecn7uJkZgiNQzMDDuYLzS5nyIUZKDSUmU9/h9/gghvqT8lMqMxOKM+KLSnNTiQ4wy HBxKErySwJATEixKTU+tSMvMAQYrTFqCg0dJhHcpSCtvcUFibnFmOkTqFKOilDjva5CEAEgio zQPrg0WIZcYZaWEeRkZGBiEeApSi3IzS1DlXzGKczAqCfNuB5nCk5lXAjf9FdBiJqDFgvE8II tLEhFSUg2Mup7+yZcXm+7edZHdPSuqz5w9cPKTPyseWJi2HFzWwrLuh9LukLze+SsWcV5frLe Ur8gu5bQpvy7bwlMLzk3/EdB4d/HHzdwtC1ccXPZQ//pCQyGxB3YZv242WRT0PMyqDqngLH3b pnn7deJzp+BrH89L7Hkizpj9vpNzk8se9nvex4/PiCnpV2Ipzkg01GIuKk4EAH+YT/+LAgAA X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-15.tower-31.messagelabs.com!1477435621!63355224!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 9735 invoked from network); 25 Oct 2016 22:47:02 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-15.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 25 Oct 2016 22:47:02 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7C5320220; Tue, 25 Oct 2016 22:46:59 +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 A028C202FF; Tue, 25 Oct 2016 22:46:58 +0000 (UTC) From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 25 Oct 2016 15:46:55 -0700 Message-Id: <1477435615-28752-2-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477435615-28752-1-git-send-email-sstabellini@kernel.org> References: <1477435615-28752-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 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 to SZ_128K for mapping if PLATFORM_QUIRK_GIC_64K_STRIDE Signed-off-by: Stefano Stabellini --- 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);