From patchwork Mon Apr 3 20:28:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9660591 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 260606032D for ; Mon, 3 Apr 2017 20:29:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 181CE28403 for ; Mon, 3 Apr 2017 20:29:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D2D62841C; Mon, 3 Apr 2017 20:29:27 +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 B57E028403 for ; Mon, 3 Apr 2017 20:29:26 +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 1cv8Yn-0004yk-Al; Mon, 03 Apr 2017 20:26: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 1cv8Ym-0004xF-IJ for xen-devel@lists.xenproject.org; Mon, 03 Apr 2017 20:26:44 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 8C/20-04817-400B2E85; Mon, 03 Apr 2017 20:26:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTZd5w6M IgxNbjSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owp1zezF5wTqPh8YhJbA+M03i5GLg4hgY2M Elf3HmeBcJYzSnz6d4a1i5GTg01AV2LHzdfMILaIQKjE0wXfwWxmASWJ/WevMYLYwgKuEhue3 geLswioSmyaOo0FxOYVsJY4f+MyWI2EgJxEw3mIGk6geOvHo2BxIQEriQkPm5gmMHIvYGRYxa hRnFpUllqka2iul1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kR6GEGINjBeHtjwCF GSQ4mJVFe9UmPIoT4kvJTKjMSizPii0pzUosPMcpwcChJ8B5bB5QTLEpNT61Iy8wBhhpMWoKD R0mEdzNImre4IDG3ODMdInWKUVFKnDcDJCEAksgozYNrg4X3JUZZKWFeRqBDhHgKUotyM0tQ5 V8xinMwKgnz3gCZwpOZVwI3/RXQYiagxU/uPARZXJKIkJJqYGTh23BOMu9E/68ezsjIdsuwKa e4VsyNn1Tgt4c96XKfSxz7Y/dNerNOG8XLRjjP9hbkbNcLn6G6W/G52uS5X47tUA5/tIfrVN+ M9B3ddxOMvMu83U57vdKbosDb6Vfx9+XPvz+WKnx9cX6vY/7WxKyUmTdWus+fn7LEaKmGQgJP I/9cFs15xkosxRmJhlrMRcWJAAlwa7NqAgAA X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1491251203!82918485!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.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21090 invoked from network); 3 Apr 2017 20:26:43 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-27.messagelabs.com with SMTP; 3 Apr 2017 20:26:43 -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 1F62F2B; Mon, 3 Apr 2017 13:26:43 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5EE673F4FF; Mon, 3 Apr 2017 13:26:42 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Mon, 3 Apr 2017 21:28:13 +0100 Message-Id: <20170403202829.7278-12-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170403202829.7278-1-andre.przywara@arm.com> References: <20170403202829.7278-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v4 11/27] 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 --- xen/arch/arm/gic-v3-its.c | 4 ++++ xen/arch/arm/gic-v3.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c index c7c32b9..880c7fc 100644 --- a/xen/arch/arm/gic-v3-its.c +++ b/xen/arch/arm/gic-v3-its.c @@ -488,6 +488,10 @@ static int gicv3_its_init_single_its(struct host_its *hw_its) return -ENOMEM; writeq_relaxed(0, hw_its->its_base + GITS_CWRITER); + /* Now enable interrupt translation and command processing 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 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 */