From patchwork Thu May 11 17:53:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9722669 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 EF4B260236 for ; Thu, 11 May 2017 17:54:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEEE7286D0 for ; Thu, 11 May 2017 17:54:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B96286E6; Thu, 11 May 2017 17:54:05 +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 8F630286D0 for ; Thu, 11 May 2017 17:54:05 +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 1d8sFU-0000K9-Bh; Thu, 11 May 2017 17:51:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8sFT-0000Ht-8x for xen-devel@lists.xenproject.org; Thu, 11 May 2017 17:51:35 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 4B/A4-01997-6A4A4195; Thu, 11 May 2017 17:51:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfpEpF Ig2srjS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyX9+oKWgQrzkzcytbAeIK3i5GLQ0hgM6PE oo3vmSGc5YwSXedmsnUxcnKwCehK7Lj5mhnEFhEIlXi64DtYEbPAGkaJc4t+ghUJC7hK3Jtzi hHEZhFQlbhz9QY7iM0rYCXx+G4HWI2EgJxEw/n7YIM4BawllkyfxQJiCwHV7Np9mnUCI/cCRo ZVjOrFqUVlqUW6JnpJRZnpGSW5iZk5uoYGxnq5qcXFiempOYlJxXrJ+bmbGIH+ZQCCHYyNX5w OMUpyMCmJ8jJOFIkU4kvKT6nMSCzOiC8qzUktPsQow8GhJMEbuRgoJ1iUmp5akZaZAww0mLQE B4+SCO8SkDRvcUFibnFmOkTqFKOilDhvO0hCACSRUZoH1wYL7kuMslLCvIxAhwjxFKQW5WaWo Mq/YhTnYFQS5t0JMoUnM68EbvoroMVMQIv7/wiDLC5JREhJNTA2RNuvfL3zpnjq8bqKvsyJO7 6p3bgw44b1O8vef6vSE55rvOpYFnyxyufovhyTnqu7fsjxRGmfKQwp1u6XK1sTVRaeO8MsSui w/oSb74usPumsZzQumnVSkU/u48zCbQWZ9rtN5ls1u7S5uwUa5d9+G29rZV7xcrtL8KZe/qjq R1/zjNo4vymxFGckGmoxFxUnAgDxbLNZaQIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1494525093!100005712!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.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47187 invoked from network); 11 May 2017 17:51:33 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-31.messagelabs.com with SMTP; 11 May 2017 17:51:33 -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 110791682; Thu, 11 May 2017 10:51:33 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE96D3F4FF; Thu, 11 May 2017 10:51:31 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Thu, 11 May 2017 18:53:18 +0100 Message-Id: <20170511175340.8448-7-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170511175340.8448-1-andre.przywara@arm.com> References: <20170511175340.8448-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni Subject: [Xen-devel] [PATCH v9 06/28] 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 Acked-by: Stefano Stabellini --- 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 07280b3..aebc257 100644 --- a/xen/arch/arm/gic-v3-its.c +++ b/xen/arch/arm/gic-v3-its.c @@ -505,6 +505,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 8140c5f..d539d6c 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 */