From patchwork Wed Sep 28 18:24:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9354557 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 1C50760757 for ; Wed, 28 Sep 2016 18:27:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F7CD297A3 for ; Wed, 28 Sep 2016 18:27:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0482E297A5; Wed, 28 Sep 2016 18:27:02 +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 70D01297A3 for ; Wed, 28 Sep 2016 18:27:01 +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 1bpJXc-00028T-Dj; Wed, 28 Sep 2016 18:25:12 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpJXa-00025m-Ub for xen-devel@lists.xenproject.org; Wed, 28 Sep 2016 18:25:11 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 9A/2F-15788-60B0CE75; Wed, 28 Sep 2016 18:25:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTZeZ+02 4wcaJ2hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8btVbtZC04LVMxc8oOxgXE/bxcjF4eQwCZG iW+7PzJDOMsZJZ5sugTkcHKwCehK7Lj5GswWEQiVeLrgO5jNLKAksf/sNUYQW1jATaJpw2mwO IuAqsTmdy/AbF4BG4mT61awgdgSAnISDefvg8U5geKrW3rZQWwhAWuJpUvns05g5F7AyLCKUa M4tagstUjXyFgvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVgvOT93EyPQw/UMDIw7GPv2+h1 ilORgUhLl7bj9OlyILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG8r55twIcGi1PTUirTMHGCowaQl OHiURHgFuYDSvMUFibnFmekQqVOMilLivF0gfQIgiYzSPLg2WHhfYpSVEuZlZGBgEOIpSC3Kz SxBlX/FKM7BqCTM2w8yhSczrwRu+iugxUxAi5eeeAGyuCQRISXVwJi0ZN1J9tuOovtmVn+YtF ZVLEr3E9ezfzo6K7Q5lh4+ddxY6J1v5VmNbRnnHu8WmmZ6N7zx8Ky21RdNIpdIfpmjOqXJpr/ TzejpVrVsLVZZAcX5Z1bVJzi0vz0xd6KB4+WvMxwn9ljv5OX98lnee6GRkdXGCWsWS3qlrDn4 cHnHdMdLFnICqu+UWIozEg21mIuKEwFky+dxagIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1475087105!36943412!2 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58269 invoked from network); 28 Sep 2016 18:25:07 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-31.messagelabs.com with SMTP; 28 Sep 2016 18:25:07 -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 401F9CFB; Wed, 28 Sep 2016 11:25:07 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7FBA93F21A; Wed, 28 Sep 2016 11:25:06 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Wed, 28 Sep 2016 19:24:43 +0100 Message-Id: <20160928182457.12433-11-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160928182457.12433-1-andre.przywara@arm.com> References: <20160928182457.12433-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [RFC PATCH 10/24] ARM: GICv3: enable ITS and 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 ITS and also 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 Reviewed-by: Stefano Stabellini --- xen/arch/arm/gic-its.c | 4 ++++ xen/arch/arm/gic-v3.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/xen/arch/arm/gic-its.c b/xen/arch/arm/gic-its.c index b7aa918..6bac422 100644 --- a/xen/arch/arm/gic-its.c +++ b/xen/arch/arm/gic-its.c @@ -449,6 +449,10 @@ int gicv3_its_init(struct host_its *hw_its) its_send_cmd_mapc(hw_its, smp_processor_id(), smp_processor_id()); its_send_cmd_sync(hw_its, smp_processor_id()); + /* Now enable interrupt translation on that ITS. */ + reg = readl_relaxed(hw_its->its_base + GITS_CTLR); + writel_relaxed(reg | GITS_CTLR_ENABLE, hw_its->its_base + GITS_CTLR); + return 0; } diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index b9387a3..57009c6 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -642,6 +642,21 @@ static void gicv3_rdist_init_lpis(void __iomem * rdist_base) gicv3_its_setup_collection(smp_processor_id()); } +/* 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; @@ -741,6 +756,10 @@ static int gicv3_cpu_init(void) if ( gicv3_enable_redist() ) return -ENODEV; + /* If the host has any ITSes, enable LPIs now. */ + if ( !list_empty(&host_its_list) ) + gicv3_enable_lpis(); + /* Set priority on PPI and SGI interrupts */ priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI << 8 | GIC_PRI_IPI);