From patchwork Thu Aug 9 11:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561305 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 5D40E14E2 for ; Thu, 9 Aug 2018 12:02:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A7DD2AF0D for ; Thu, 9 Aug 2018 12:02:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E4CC2AF52; Thu, 9 Aug 2018 12:02:32 +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 CA6162AF0D for ; Thu, 9 Aug 2018 12:02:31 +0000 (UTC) Received: from localhost ([::1]:50100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjeB-0002Ox-3Q for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:02:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPW-0004s0-8n for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPT-00079m-KS for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:22 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36810) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPT-00078q-AX for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:19 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiaXV178074; Thu, 9 Aug 2018 11:47:18 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=tVyNK7jTxgN9LupKp13C4igx4Hn14u7RR4QEBbP/++M=; b=Em+1BIm7bujQC8WlMjLlNp/HsDPFCUyoKvkDqx8hM+6A+K6eauAzDbXYnBdMGbt7uec8 i7+Yc06Bt+nVSUqYzPomrEETR7BuKz17DKSyXet5uR/4Xztwuhwm5nOoV3AdS3VaHMUy fweybKQgH02w5ofbe1HYuTaJfrMhIrOhcSQq0U05jMa4xwb4E1J6iXFHXsuUPp0OwI+V OyfP3/s9p3dvqP2emC7NX2fM0lt021oBi8nh2NZZLyWoXzRYSNfYKPYQWZK7a3+ai+sX JBxERcOyzze+lMNqcuTswEMtPIWICwA9dRL+WNyDSJeFnP9HP3B0n7Y6zkWX4SNAuOHh yg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2kn43p2uwb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:18 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlH0V006212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:17 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79BlGMR004949; Thu, 9 Aug 2018 11:47:16 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:16 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:20 +0300 Message-Id: <1533815202-11967-8-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: 141.146.126.78 Subject: [Qemu-devel] [PATCH 07/29] vmsvga: Handle SVGA_CMD_FRONT_ROP_FILL 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 We parse the command structure, but ignore the hint given by command. Without doing so, command FIFO could get out of sync and cause vmware-svga device to hang. From Linux kernel drivers/gpu/drm/vmwgfx/device_include/svga_reg.h: /* * SVGA_CMD_FRONT_ROP_FILL -- * * This is a hint which tells the SVGA device that the driver has * just filled a rectangular region of the GFB with a solid * color. Instead of reading these pixels from the GFB, the device * can assume that they all equal 'color'. This is primarily used * for remote desktop protocols. * * Availability: * SVGA_FIFO_CAP_ACCELFRONT */ typedef struct { uint32 color; /* In the same format as the GFB */ uint32 x; uint32 y; uint32 width; uint32 height; uint32 rop; /* Must be SVGA_ROP_COPY */ } SVGAFifoCmdFrontRopFill; Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index d3a78809673d..fab6443a87e2 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -693,6 +693,14 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) goto badcmd; #endif + case SVGA_CMD_FRONT_ROP_FILL: + len -= 1; + if (len < 0) { + goto rewind; + } + args = 6; + goto ignoredcmd; + /* * Deprecated commands are neither documented in VMware SVGA development kit * nor in Linux kernel vmware-svga driver source code. @@ -759,7 +767,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) */ case SVGA_CMD_SURFACE_FILL: case SVGA_CMD_SURFACE_COPY: - case SVGA_CMD_FRONT_ROP_FILL: case SVGA_CMD_FENCE: case SVGA_CMD_INVALID_CMD: break; /* Nop */