From patchwork Thu Aug 9 11:46:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9530A157B for ; Thu, 9 Aug 2018 12:10:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82DB02A450 for ; Thu, 9 Aug 2018 12:10:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7773C2AF42; Thu, 9 Aug 2018 12:10:55 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09F402A450 for ; Thu, 9 Aug 2018 12:10:54 +0000 (UTC) Received: from localhost ([::1]:50145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjmH-0001vi-KG for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:10:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQ4-0005Kh-TD for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQ2-0007We-8l for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:56 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQ1-0007WQ-VU for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:54 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiRYC145721; Thu, 9 Aug 2018 11:47:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=s93oMmNGmOMDr50cYOsYmWSS2pnthhCjSodQ6L/mHKU=; b=PLjKXQtPXnyamSEAmuKCG4hE8HDJhH5Cazy/qZklDLyGIJPDbu3mac35Y2U0YXkrYfZC Frf4BhthscBo6zkjDvLYKk5jHaeMg7Co01UGzjuVDi7o8skvI1Yc04mLPklYVk7WsqIZ AZtjvSQzngPuQGR0T340I0aIi/FQxVK9WqPQhQWSeENcHAbp1limI0EXTeze0DaCfVgT rDfVJnceF5tspOTY6JGQh/A8bG59orkb3TpeUV3E/5qgW6b7Yhu81klSsaB242wAqVaE m/czIBdZATKcyibhB1oA/55PryNR90ifJlNMmmX42ovq39A+jBydkCpUI9rhSUAMxGv0 tg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2kn3jtav72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:52 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79Blqar007385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:52 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79Blp3t000506; Thu, 9 Aug 2018 11:47:51 GMT Received: from liran-pc.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Aug 2018 04:47:51 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:32 +0300 Message-Id: <1533815202-11967-20-git-send-email-liran.alon@oracle.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533815202-11967-1-git-send-email-liran.alon@oracle.com> References: <1533815202-11967-1-git-send-email-liran.alon@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8979 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808090123 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [PATCH 19/29] vmsvga: Handle SVGA_CMD_FENCE command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: habkost@redhat.com, mtosatti@redhat.com, Liran Alon , kraxel@redhat.com, pbonzini@redhat.com, rth@twiddle.net, Leonid Shatz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Leonid Shatz According to Linux kernel drivers/gpu/drm/vmwgfx/device_include/svga_reg.h: /* * SVGA_CMD_FENCE -- * * Insert a synchronization fence. When the SVGA device reaches * this command, it will copy the 'fence' value into the * SVGA_FIFO_FENCE register. It will also compare the fence against * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will * raise this interrupt. * * Availability: * SVGA_FIFO_FENCE for this command, * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL. */ Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index dc5f4681f0d3..73e373665bdb 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -217,6 +217,7 @@ enum { SVGA_FIFO_CAPABILITIES = 4, SVGA_FIFO_FLAGS, + /* Valid with SVGA_FIFO_CAP_FENCE */ SVGA_FIFO_FENCE, /* @@ -729,6 +730,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) int x, y, dx, dy, width, height; struct vmsvga_cursor_definition_s cursor; uint32_t cmd_start; + uint32_t fence_arg; bool cmd_ignored; bool irq_pending = false; bool fifo_progress = false; @@ -832,6 +834,28 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) args = 6; goto ignoredcmd; + case SVGA_CMD_FENCE: + len -= 2; + if (len < 0) { + goto rewind; + } + + fence_arg = vmsvga_fifo_read(s); + s->fifo[SVGA_FIFO_FENCE] = cpu_to_le32(fence_arg); + + if (s->irq_mask & SVGA_IRQFLAG_ANY_FENCE) { + s->irq_status |= SVGA_IRQFLAG_ANY_FENCE; + irq_pending = true; + } + if ((s->irq_mask & SVGA_IRQFLAG_FENCE_GOAL) + && (s->fifo_min > SVGA_FIFO_FENCE_GOAL) + && (s->fifo[SVGA_FIFO_FENCE_GOAL] == fence_arg)) { + s->irq_status |= SVGA_IRQFLAG_FENCE_GOAL; + irq_pending = true; + } + + break; + /* * Deprecated commands are neither documented in VMware SVGA development kit * nor in Linux kernel vmware-svga driver source code. @@ -899,13 +923,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) case SVGA_CMD_SURFACE_ALPHA_BLEND: /* deprecated */ args = 12; goto badcmd; - case SVGA_CMD_FENCE: - len -= 1; - if (len < 0) { - goto rewind; - } - args = 1; - goto badcmd; default: args = 0; @@ -1463,7 +1480,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s, &error_fatal); s->fifo = (uint32_t *)memory_region_get_ram_ptr(&s->fifo_ram); s->num_fifo_regs = SVGA_FIFO_NUM_REGS; - s->fifo[SVGA_FIFO_CAPABILITIES] = 0; + s->fifo[SVGA_FIFO_CAPABILITIES] = SVGA_FIFO_CAP_FENCE; s->fifo[SVGA_FIFO_FLAGS] = 0; vga_common_init(&s->vga, OBJECT(dev));