From patchwork Wed Oct 18 21:29:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 10015359 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 A0D3A602C8 for ; Wed, 18 Oct 2017 21:32:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9369528D24 for ; Wed, 18 Oct 2017 21:32:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8774028D2A; Wed, 18 Oct 2017 21:32:29 +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 3708B28D24 for ; Wed, 18 Oct 2017 21:32:28 +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 1e4vue-0007KE-1y; Wed, 18 Oct 2017 21:30:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4vud-00075E-8D for xen-devel@lists.xen.org; Wed, 18 Oct 2017 21:30:03 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id B5/24-23912-AD7C7E95; Wed, 18 Oct 2017 21:30:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42I5NlE2Wffm8ee RBpN/alks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlv5h5iKXjPXbG2cw1LA+N1zi5GLg4hgSVM Eg+/3GTvYuTkYBFwkNix/B5LFyMHB6NAjMSDH9YgYUaBMInJl5ewQpRoS7yZdp8RxGYTMJT4+ 2QTG0i5BJC95DMHSFhEQFri2ufLYCXMAgYSx7pWMoKUCAt4SDzdzwkS5hXwlti6cj4ziC0qoC tx6N8fNoi4oMTJmU9YIFq1JJZP38YygZFvFpLULCSpBYxMqxg1ilOLylKLdI0M9JKKMtMzSnI TM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAgOqnoGBcQdj42y/Q4ySHExKory6B55FCvEl5adU ZiQWZ8QXleakFh9ilOHgUJLgPXvseaSQYFFqempFWmYOMLRh0hIcPEoivPtB0rzFBYm5xZnpE KlTjIpS4rx7QRICIImM0jy4Nlg8XWKUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzHsBZApPZl 4J3PRXQIuZgBavc3oCsrgkESEl1cBosX+dQofz65RZqmLhog13N7ycyWVhav5ldu/sPM2TkdW NYpm2YTy75lq05d19Vv0olPl8VA1j4sdjm0I85/nUqq5L27Vc5pJvqM+BhyKbM/aoH773iq1w njHH1KdrFt+YZ3qF42pBat968eWZT1NExG+YxR4S+fAs83YZ47GI60zflToOzHisxFKckWiox VxUnAgA1fy9bKICAAA= X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-12.tower-206.messagelabs.com!1508362200!71326947!1 X-Originating-IP: [198.145.29.99] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38353 invoked from network); 18 Oct 2017 21:30:01 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.99) by server-12.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Oct 2017 21:30:01 -0000 Received: from [10.149.184.130] (162-198-228-33.lightspeed.wlfrct.sbcglobal.net [162.198.228.33]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A254E21879; Wed, 18 Oct 2017 21:29:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A254E21879 Date: Wed, 18 Oct 2017 14:29:58 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: xen-devel@lists.xen.org Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Cc: julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2] arm: configure interrupts to be in non-secure group1 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Xen uses non-secure group1 interrupts, however it doesn't configure the GICv3 accordingly. Xen needs to set GICD_IGROUPR for SPIs and GICR_IGROUPR0 for local interrupt to "1" to specify that interrupts belong to group1. This is particularly important if the system has GICD_CTLR.DS set, also see commit 7c9b973061b03af62734f613f6abec46c0dd4a88 in Linux. Signed-off-by: Stefano Stabellini Reviewed-by: Julien Grall Reviewed-by: Andre Przywara --- This is a candidate for stable backports. diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 74d00e0..77da892 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -569,6 +569,13 @@ static void __init gicv3_dist_init(void) for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i += 32 ) writel_relaxed(0xffffffff, GICD + GICD_ICENABLER + (i / 32) * 4); + /* + * Configure SPIs as non-secure Group-1. This will only matter + * if the GIC only has a single security state. + */ + for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i += 32 ) + writel_relaxed(GENMASK(31, 0), GICD + GICD_IGROUPR + (i / 32) * 4); + gicv3_dist_wait_for_rwp(); /* Turn on the distributor */ @@ -775,6 +782,8 @@ static int gicv3_cpu_init(void) */ writel_relaxed(0xffff0000, GICD_RDIST_SGI_BASE + GICR_ICENABLER0); writel_relaxed(0x0000ffff, GICD_RDIST_SGI_BASE + GICR_ISENABLER0); + /* Configure SGIs/PPIs as non-secure Group-1 */ + writel_relaxed(GENMASK(31, 0), GICD_RDIST_SGI_BASE + GICR_IGROUPR0); gicv3_redist_wait_for_rwp();