From patchwork Fri Jun 9 17:41:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9778987 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 3F05660318 for ; Fri, 9 Jun 2017 17:43:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BF67286E2 for ; Fri, 9 Jun 2017 17:43:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20DAC286F6; Fri, 9 Jun 2017 17:43:57 +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 C7D17286E2 for ; Fri, 9 Jun 2017 17:43:56 +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 1dJNvX-0004Su-34; Fri, 09 Jun 2017 17:42:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJNvW-0004P5-9k for xen-devel@lists.xenproject.org; Fri, 09 Jun 2017 17:42:26 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 0E/7D-29088-10EDA395; Fri, 09 Jun 2017 17:42:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTZfxnlW kwbN9LBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bBG0+YCp7yVny6HN7A+Jiri5GLQ0hgM6PE 8pcv2SCc5YwSfbtvsncxcnKwCehK7Lj5mhnEFhEIlXi64DszSBGzwHVGidM75gN1cHAIC9hIb PhYAFLDIqAq8f3IAyYQm1fAWuLBwmUsILaEgJxEw/n7YHM4geLb9qxlA7GFBKwkWg5dZp/AyL 2AkWEVo3pxalFZapGuuV5SUWZ6RkluYmaOrqGBsV5uanFxYnpqTmJSsV5yfu4mRqB3GYBgB2P jd6dDjJIcTEqivNMKrCKF+JLyUyozEosz4otKc1KLDzHKcHAoSfC+ugOUEyxKTU+tSMvMAYYZ TFqCg0dJhPfFSaA0b3FBYm5xZjpE6hSjopQ470aQPgGQREZpHlwbLLQvMcpKCfMyAh0ixFOQW pSbWYIq/4pRnINRSZh3F8gUnsy8Erjpr4AWMwEtXvLOAmRxSSJCSqqBsWNeQK7xlmVRc3W6pK 2fa1mXMbW+esq7+HaizX+TrKrVWvNl9Tb4CiXxPZioI+NktvPRmlB3zsaVgZUfXiw9vnqrRKi xxxeXW9JGNUYrLM9W3Sl7GJy59JtAhE6Btr5bs1R/yEXZqsr+kGMPdFK+1XuytBTMzfuvzflY gf1Aqvsm30kxnCxKLMUZiYZazEXFiQBXz6ELaAIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1497030144!104777080!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 63039 invoked from network); 9 Jun 2017 17:42:24 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-31.messagelabs.com with SMTP; 9 Jun 2017 17:42:24 -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 523FD1596; Fri, 9 Jun 2017 10:42:24 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0A08E3F578; Fri, 9 Jun 2017 10:42:22 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Fri, 9 Jun 2017 18:41:36 +0100 Message-Id: <20170609174141.5068-30-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 29/34] ARM: vITS: handle DISCARD 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 DISCARD command drops the connection between a DeviceID/EventID and an LPI/collection pair. We mark the respective structure entries as not allocated and make sure that any queued IRQs are removed. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- xen/arch/arm/vgic-v3-its.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 49969e4..7d2bb30 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -715,6 +715,29 @@ out_unlock: return ret; } +static int its_handle_discard(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t devid = its_cmd_get_deviceid(cmdptr); + uint32_t eventid = its_cmd_get_id(cmdptr); + int ret; + + spin_lock(&its->its_lock); + + /* Remove from the radix tree and remove the host entry. */ + ret = its_discard_event(its, devid, eventid); + if ( ret ) + goto out_unlock; + + /* Remove from the guest's ITTE. */ + if ( !write_itte(its, devid, eventid, UNMAPPED_COLLECTION, INVALID_LPI) ) + ret = -1; + +out_unlock: + spin_unlock(&its->its_lock); + + return ret; +} + #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) #define ITS_CMD_OFFSET(reg) ((reg) & GENMASK(19, 5)) @@ -754,6 +777,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its) case GITS_CMD_CLEAR: ret = its_handle_clear(its, command); break; + case GITS_CMD_DISCARD: + ret = its_handle_discard(its, command); + break; case GITS_CMD_INT: ret = its_handle_int(its, command); break;