From patchwork Fri Jun 9 17:41:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9778989 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 74C5960318 for ; Fri, 9 Jun 2017 17:43:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 612D3286E2 for ; Fri, 9 Jun 2017 17:43:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56108286F8; Fri, 9 Jun 2017 17:43: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 F34D1286E2 for ; Fri, 9 Jun 2017 17:43: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 1dJNur-0003Jw-0q; Fri, 09 Jun 2017 17:41:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJNuq-0003J4-5k for xen-devel@lists.xenproject.org; Fri, 09 Jun 2017 17:41:44 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id E1/2F-06719-7DDDA395; Fri, 09 Jun 2017 17:41:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTff6Xat Ig23NrBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8alb/oFc3gqzr78ydLAeIyzi5GLQ0hgM6PE v/UX2CGc5YwS8yf/Ze1i5ORgE9CV2HHzNTOILSIQKvF0wXdmkCJmgeuMEqd3zGcDSQgL2El8X naWHcRmEVCV2Nl/HqyZV8BK4sTOi2DNEgJyEg3n74PZnALWEtv2rAXrFQKqaTl0mX0CI/cCRo ZVjBrFqUVlqUW6hiZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBHmYAgh2M1zc GHGKU5GBSEuWdVmAVKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC99UdoJxgUWp6akVaZg4w1GDS Ehw8SiK8L04CpXmLCxJzizPTIVKnGBWlxHk3gvQJgCQySvPg2mDhfYlRVkqYlxHoECGegtSi3 MwSVPlXjOIcjErCvLtApvBk5pXATX8FtJgJaPGSdxYgi0sSEVJSDYzZyucnT1in8CXojNHpKV UR8w459vjU5rG+EBHLdHk6b4rZpQuWotOZziq4CJt9ZLD/nnFcO4pP+7DJfgaPVR9/fzmk0cL vEvg/bf3qLaICs4JOLdKeELFw+o607MgHGRMKKvIPp9fe26Y9d8rafXvFpx+dslJTqznkh9ij JcabRRk+O6WllPUqsRRnJBpqMRcVJwIABKn2u2oCAAA= X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1497030102!66523263!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 35729 invoked from network); 9 Jun 2017 17:41:42 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-21.messagelabs.com with SMTP; 9 Jun 2017 17:41:42 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3BA7015BF; Fri, 9 Jun 2017 10:41:42 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E876F3F578; Fri, 9 Jun 2017 10:41:40 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Fri, 9 Jun 2017 18:41:10 +0100 Message-Id: <20170609174141.5068-4-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170609174141.5068-1-andre.przywara@arm.com> References: <20170609174141.5068-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni , Manish Jaggi Subject: [Xen-devel] [PATCH v11 03/34] ARM: GICv3: enable LPIs on the host 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 Now that the host part of the ITS code is in place, we can enable the LPIs on each redistributor to get the show rolling. At this point there would be no LPIs mapped, as guests don't know about the ITS yet. Signed-off-by: Andre Przywara Acked-by: Stefano Stabellini --- xen/arch/arm/gic-v3.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index a559e5e..eda3410 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -620,6 +620,21 @@ static int gicv3_enable_redist(void) return 0; } +/* Enable LPIs on this redistributor (only useful when the host has an ITS). */ +static bool gicv3_enable_lpis(void) +{ + uint32_t val; + + val = readl_relaxed(GICD_RDIST_BASE + GICR_TYPER); + if ( !(val & GICR_TYPER_PLPIS) ) + return false; + + val = readl_relaxed(GICD_RDIST_BASE + GICR_CTLR); + writel_relaxed(val | GICR_CTLR_ENABLE_LPIS, GICD_RDIST_BASE + GICR_CTLR); + + return true; +} + static int __init gicv3_populate_rdist(void) { int i; @@ -731,11 +746,14 @@ static int gicv3_cpu_init(void) if ( gicv3_enable_redist() ) return -ENODEV; + /* If the host has any ITSes, enable LPIs now. */ if ( gicv3_its_host_has_its() ) { ret = gicv3_its_setup_collection(smp_processor_id()); if ( ret ) return ret; + if ( !gicv3_enable_lpis() ) + return -EBUSY; } /* Set priority on PPI and SGI interrupts */