From patchwork Wed Sep 28 18:24:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9354571 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 943DB60757 for ; Wed, 28 Sep 2016 18:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88271297A3 for ; Wed, 28 Sep 2016 18:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D27C297A5; Wed, 28 Sep 2016 18:27:21 +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 31BB5297A3 for ; Wed, 28 Sep 2016 18:27:21 +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 1bpJXe-0002Fb-SY; Wed, 28 Sep 2016 18:25:14 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpJXe-0002Cq-0c for xen-devel@lists.xenproject.org; Wed, 28 Sep 2016 18:25:14 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id 86/F5-21986-90B0CE75; Wed, 28 Sep 2016 18:25:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTZeD+02 4wbXXZhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a6BwfZCs7zVjz88YC9gXEzVxcjF4eQwEZG ia5Xz5kgnOWMEh3/XzB2MXJysAnoSuy4+ZoZxBYRCJV4uuA7mM0soCSx/+w1sBphAUuJg03fW boYOThYBFQl1rwPBgnzCthItDy5yARiSwjISTScvw/WygkUX93Syw5iCwlYSyxdOp91AiP3Ak aGVYwaxalFZalFukYWeklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUnFesn5uZsYgf5lAIIdjOf XBh5ilORgUhLl7bj9OlyILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG8r55twIcGi1PTUirTMHGCg waQlOHiURHgFuYDSvMUFibnFmekQqVOMilLivKwgCQGQREZpHlwbLLgvMcpKCfMyAh0ixFOQW pSbWYIq/4pRnINRSZhXCGQKT2ZeCdz0V0CLmYAWLz3xAmRxSSJCSqqB0fkid8yHHZ8sF5oaO6 7d9lT/6p9EvXWmlb0LkztyqvLXWe5XdvywfbNq4p17q2s0T/XLzIqL+LqqvcFo5UyH0Pty/DE aBusXWj/1LLz4l2v3j4Xml8wtHt8pzyw8YHHG56SZ1Y6Nh05I/srZZaSsWTxHPSN0fquS8z3/ 6uSLC733mzo+ytsersRSnJFoqMVcVJwIAMAKHKBpAgAA X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1475087112!61750145!1 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 55522 invoked from network); 28 Sep 2016 18:25:12 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-27.messagelabs.com with SMTP; 28 Sep 2016 18:25:12 -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 2553015; Wed, 28 Sep 2016 11:25:12 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 673E03F21A; Wed, 28 Sep 2016 11:25:11 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Wed, 28 Sep 2016 19:24:48 +0100 Message-Id: <20160928182457.12433-16-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 15/24] ARM: vITS: handle MAPC 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 MAPC command associates a given collection ID with a given redistributor, thus mapping collections to VCPUs. We just store the vcpu_id in the collection table for that. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-its.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xen/arch/arm/vgic-its.c b/xen/arch/arm/vgic-its.c index 7072753..caad320 100644 --- a/xen/arch/arm/vgic-its.c +++ b/xen/arch/arm/vgic-its.c @@ -223,6 +223,33 @@ out_unlock: return ret; } +static int its_handle_mapc(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t collid = its_cmd_get_collection(cmdptr); + uint64_t rdbase = its_cmd_mask_field(cmdptr, 2, 16, 44); + int ret = -1; + + if ( collid >= its->max_collections ) + return ret; + + if ( rdbase >= its->d->max_vcpus ) + return ret; + + spin_lock(&its->its_lock); + if ( its->coll_table ) + { + if ( its_cmd_get_validbit(cmdptr) ) + its->coll_table[collid] = rdbase; + else + its->coll_table[collid] = UNMAPPED_COLLECTION; + + ret = 0; + } + spin_unlock(&its->its_lock); + + return ret; +} + #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its, @@ -249,6 +276,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its, case GITS_CMD_INT: its_handle_int(its, cmdptr); break; + case GITS_CMD_MAPC: + its_handle_mapc(its, cmdptr); + break; case GITS_CMD_SYNC: /* We handle ITS commands synchronously, so we ignore SYNC. */ break;