From patchwork Thu Mar 16 11:20:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9627951 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 7DCC260522 for ; Thu, 16 Mar 2017 11:20:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71F8C285B5 for ; Thu, 16 Mar 2017 11:20:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66E9728604; Thu, 16 Mar 2017 11:20:52 +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 1B42F28643 for ; Thu, 16 Mar 2017 11:20:52 +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 1coTRC-0008MT-92; Thu, 16 Mar 2017 11:19:22 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coTRB-0008K8-Lz for xen-devel@lists.xenproject.org; Thu, 16 Mar 2017 11:19:21 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 2D/4C-21675-9B47AC85; Thu, 16 Mar 2017 11:19:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXdHyak IgzOnxS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyHPx+xFBwXrvjx5jRrA+NB/i5GLg4hgc2M Ekc/TGGBcJYzSjxtbGDrYuTkYBPQldhx8zUziC0iECox5+cjMJtZoFLi4of9QDUcHMICVhITG 9RAwiwCqhL71/czgdi8AjYSL+48ACuXEJCTaDh/H8zmBIp3nNwDNl5IwFri89HP7BMYuRcwMq xi1ChOLSpLLdI1NNdLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAj0LwMQ7GC8vTH gEKMkB5OSKO/1cycihPiS8lMqMxKLM+KLSnNSiw8xynBwKEnw1t8GygkWpaanVqRl5gADDSYt wcGjJML7CSTNW1yQmFucmQ6ROsWoKCXO+wwkIQCSyCjNg2uDBfclRlkpYV5GoEOEeApSi3IzS 1DlXzGKczAqCfN+BpnCk5lXAjf9FdBiJqDFiT+PgCwuSURISTUwVq9t+nCQM6lBJOfe5M77c4 5snbs0s6Fxyt3jHhfTAl9VzztrtZztxxzbs6qnudbx5X95deD8l+9Bq1e+3WH7RlL1su2Bizr N7k4TFiRmnQ16nlK9RPK76T6FJxOvbZtiUnmzxaYgU01m1W+xlLi8t4f0Z3ZIWGivnGHn0h3+ xuFA8u0/M6rt7iqxFGckGmoxFxUnAgCZ06wAaQIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1489663159!62531632!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 30457 invoked from network); 16 Mar 2017 11:19:20 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-21.messagelabs.com with SMTP; 16 Mar 2017 11:19:20 -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 AA9A813D5; Thu, 16 Mar 2017 04:19:19 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A799B3F5C9; Thu, 16 Mar 2017 04:19:18 -0700 (PDT) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Thu, 16 Mar 2017 11:20:27 +0000 Message-Id: <20170316112030.20419-25-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170316112030.20419-1-andre.przywara@arm.com> References: <20170316112030.20419-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Shanker Donthineni , Vijay Kilari Subject: [Xen-devel] [PATCH v2 24/27] ARM: vITS: handle INVALL command 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 The INVALL command instructs an ITS to invalidate the configuration data for all LPIs associated with a given redistributor (read: VCPU). This is nasty to emulate exactly with our architecture, so we just scan the pending table and inject _every_ LPI found there that got enabled. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-its.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 8af06ac..cc12c1c 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -319,6 +319,40 @@ static int its_handle_inv(struct virt_its *its, uint64_t *cmdptr) return 0; } +/* + * INVALL updates the per-LPI configuration status for every LPI mapped to + * a particular redistributor. Since our property table is referenced when + * needed, we don't need to sync anything, really. But we have to take care + * of LPIs getting enabled if there is an interrupt pending. + * To catch every LPI without iterating through the device table we just + * look for set bits in our virtual pending table and check the status of + * the enabled bit in the respective property table entry. + * This actually covers every (pending) LPI from every redistributor, + * but update_lpi_enabled_status() is a NOP for LPIs not being mapped + * to the redistributor/VCPU we are interested in. + */ +static int its_handle_invall(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t collid = its_cmd_get_collection(cmdptr); + struct vcpu *vcpu; + int vlpi = 0; + + spin_lock(&its->its_lock); + vcpu = get_vcpu_from_collection(its, collid); + spin_unlock(&its->its_lock); + + do { + vlpi = find_next_bit(vcpu->arch.vgic.pendtable, + its->d->arch.vgic.nr_lpis, vlpi); + if ( vlpi >= its->d->arch.vgic.nr_lpis ) + break; + + update_lpi_enabled_status(its, vcpu, vlpi); + } while (1); + + return 0; +} + static int its_handle_mapc(struct virt_its *its, uint64_t *cmdptr) { uint32_t collid = its_cmd_get_collection(cmdptr); @@ -485,6 +519,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its, case GITS_CMD_INV: its_handle_inv(its, cmdptr); break; + case GITS_CMD_INVALL: + its_handle_invall(its, cmdptr); + break; case GITS_CMD_MAPC: its_handle_mapc(its, cmdptr); break;