From patchwork Thu May 11 17:53:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9722631 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 1A49C6031B for ; Thu, 11 May 2017 17:53:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A521286D0 for ; Thu, 11 May 2017 17:53:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F707286E5; Thu, 11 May 2017 17:53:26 +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 BD7AF286D0 for ; Thu, 11 May 2017 17:53:25 +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 1d8sFh-0000en-Ts; Thu, 11 May 2017 17:51:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8sFh-0000cV-1c for xen-devel@lists.xenproject.org; Thu, 11 May 2017 17:51:49 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id EE/C9-01744-4B4A4195; Thu, 11 May 2017 17:51:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTXfzEpF Ig+ldhhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aRFfeZC27xVLw58oitgfE7ZxcjF4eQwGZG iWndHUwQznJGif8d69m6GDk52AR0JXbcfM0MYosIhEo8XfCdGaSIWWANo8S5RT/BioQFzCX2z NkLZrMIqEr8+X4GrIFXwFpi9fFL7CC2hICcRMP5+2BxTqD4kumzWEBsIQEriV27T7NOYORewM iwilGjOLWoLLVI19BUL6koMz2jJDcxM0fX0MBYLze1uDgxPTUnMalYLzk/dxMj0McMQLCDcc1 2z0OMkhxMSqK8jBNFIoX4kvJTKjMSizPii0pzUosPMcpwcChJ8F5dDJQTLEpNT61Iy8wBBhtM WoKDR0mEdwlImre4IDG3ODMdInWKUVFKnLcdJCEAksgozYNrgwX4JUZZKWFeRqBDhHgKUotyM 0tQ5V8xinMwKgnz7gSZwpOZVwI3/RXQYiagxf1/hEEWlyQipKQaGPeeSdRjsf/bXbGzsmySn+ jPipxIuzVd76IcXvo2vb8y3fnPIa2VYboRpj/VJ6m+WnRY2GVys2O8ws/c+Ytrdj7Ln/7no81 x671xya8fVy5tmCW2at3dlXzKm6XtuXknMZ6xZ1ANPxSe3X1eeGm9yJs2jhinzIcCOQk/mpaJ eiSa2t0/I7nkkxJLcUaioRZzUXEiAGqm0FtrAgAA X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1494525107!44544489!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 51796 invoked from network); 11 May 2017 17:51:47 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-9.tower-31.messagelabs.com with SMTP; 11 May 2017 17:51:47 -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 0A5A819F6; Thu, 11 May 2017 10:51:47 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D82063F4FF; Thu, 11 May 2017 10:51:45 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Thu, 11 May 2017 18:53:28 +0100 Message-Id: <20170511175340.8448-17-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 16/28] ARM: vITS: handle INT 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 INT command sets a given LPI identified by a DeviceID/EventID pair as pending and thus triggers it to be injected. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic-v3-its.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 12ec5f1..f9379c9 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -300,6 +300,24 @@ static uint64_t its_cmd_mask_field(uint64_t *its_cmd, unsigned int word, #define its_cmd_get_validbit(cmd) its_cmd_mask_field(cmd, 2, 63, 1) #define its_cmd_get_ittaddr(cmd) (its_cmd_mask_field(cmd, 2, 8, 44) << 8) +static int its_handle_int(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t devid = its_cmd_get_deviceid(cmdptr); + uint32_t eventid = its_cmd_get_id(cmdptr); + struct vcpu *vcpu; + uint32_t vlpi; + + if ( !read_itte(its, devid, eventid, &vcpu, &vlpi) ) + return -1; + + if ( vlpi == INVALID_LPI ) + return -1; + + vgic_vcpu_inject_irq(vcpu, vlpi); + + return 0; +} + #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) #define ITS_CMD_OFFSET(reg) ((reg) & GENMASK(19, 5)) @@ -329,6 +347,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its) switch ( its_cmd_get_command(command) ) { + case GITS_CMD_INT: + ret = its_handle_int(its, command); + break; case GITS_CMD_SYNC: /* We handle ITS commands synchronously, so we ignore SYNC. */ break;