From patchwork Thu Aug 9 11:46:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561263 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 A43001057 for ; Thu, 9 Aug 2018 11:50:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 800962AE68 for ; Thu, 9 Aug 2018 11:50:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DF792AEA8; Thu, 9 Aug 2018 11:50:05 +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 11B352AEA8 for ; Thu, 9 Aug 2018 11:50:04 +0000 (UTC) Received: from localhost ([::1]:50025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjS8-0006xW-1K for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:50:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPE-0004cX-Fz for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPB-00071i-SN for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:04 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47852) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPB-00071Z-IX for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:01 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiCKI162694; Thu, 9 Aug 2018 11:47:00 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=56/8+QQTxRNPSrna7VTFUdLgBw77tFOvMFuFPC5RPRk=; b=VBNm5hIv+w9x2dPXS/K81CCQNnMLT7tdT/7AIgalLAY8bJHZOSeJLIHUhrUwGmTv+grP iFvwmffFrXBKUdinKTC24Du+BDAOJR5hRfMcYW52oiM29MuGAxzKJdnAdm7AUkUr5LLz 1qD7NZtrChii9w5fFDc2cpWadRiYTIGzgrD0Q/cl4BIr745UM82uyVblkca83e4qdPyl 9GsNrTL13u06rfnC8j2FeXh6ZkbqthUqJDuXv3B4160WQAsaY+KbBOCQy7JS/BMLarJY HAExLH/4Ekd7narn0Y8P9tbCbcPh57p7f+qNQOdXbVJf2BBT5FcQ9OFXed6/5xevb1kN PA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2kn1ndaxxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:00 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BkxjZ019966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:46:59 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BkxaI030837; Thu, 9 Aug 2018 11:46:59 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:46:59 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:14 +0300 Message-Id: <1533815202-11967-2-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=842 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.79 Subject: [Qemu-devel] [PATCH 01/29] vmsvga: Stop using redundant fifo pointer variable 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 Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 0bbb78b9a6fd..60a672530840 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -63,7 +63,6 @@ struct vmsvga_state_s { int syncing; MemoryRegion fifo_ram; - uint8_t *fifo_ptr; unsigned int fifo_size; uint32_t *fifo; @@ -1022,7 +1021,6 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) case SVGA_REG_CONFIG_DONE: if (value) { - s->fifo = (uint32_t *) s->fifo_ptr; vga_dirty_log_stop(&s->vga); } s->config = !!value; @@ -1179,9 +1177,6 @@ static int vmsvga_post_load(void *opaque, int version_id) struct vmsvga_state_s *s = opaque; s->invalidated = 1; - if (s->config) { - s->fifo = (uint32_t *) s->fifo_ptr; - } return 0; } @@ -1240,7 +1235,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s, s->fifo_size = SVGA_FIFO_SIZE; memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size, &error_fatal); - s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram); + s->fifo = (uint32_t *)memory_region_get_ram_ptr(&s->fifo_ram); vga_common_init(&s->vga, OBJECT(dev)); vga_init(&s->vga, OBJECT(dev), address_space, io, true); From patchwork Thu Aug 9 11:46:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561289 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 BA17A139A for ; Thu, 9 Aug 2018 11:56:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A78422AED6 for ; Thu, 9 Aug 2018 11:56:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BA082AEF9; Thu, 9 Aug 2018 11:56:46 +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 3AE782AED6 for ; Thu, 9 Aug 2018 11:56:46 +0000 (UTC) Received: from localhost ([::1]:50062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjYb-0003z1-DO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:56:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPH-0004ex-AL for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPE-00072E-MX for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:07 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPE-000720-CB for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:04 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79Bj4UZ138635; Thu, 9 Aug 2018 11:47:03 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=Xs9GOostt6VkUVSjbBngPMYa4MEOCFbLHcv99Kp3f+A=; b=moMobxhKxdv9S0M8DaUJLuUppCL2t+7WQ2fHfk8JMsY7x1UWChXtkyDudf1zad0j6UjR 2bBSLwf5JAip6idqsrePhO1xZdJNJcClhnwS1PvuCcN7Nn6NLwBQCJU3FoIwW681QsD4 k8xCIxRPUFwec0J+9GyRdr2nHy33tRL0RwipYMonVrDVfSSEfPkDQCmMhUdZIos/5z/6 wG+tOgr1uEwAYZ2H1wR6XUwSif69Z597y0zGULl4GxwCHG91tLFF0gYzf/IWFyX3uXWw CjCbBgo2M9jI0E74kchB3UVgG8jD7Lw68FqjICPWe2gM91WRQC1LfGOfu1FalB5G1e+v rQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2kn4sq2s6k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:03 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bl2Ck010886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:03 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bl21d030948; Thu, 9 Aug 2018 11:47:02 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:02 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:15 +0300 Message-Id: <1533815202-11967-3-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=803 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.85 Subject: [Qemu-devel] [PATCH 02/29] vmsvga: Group together commands by their handling 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 Should not change semantics. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 60 ++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 60a672530840..f8c5b64cfd7c 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -607,6 +607,8 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) cmd_start = s->fifo_stop; switch (cmd = vmsvga_fifo_read(s)) { + + /* Implemented commands */ case SVGA_CMD_UPDATE: case SVGA_CMD_UPDATE_VERBOSE: len -= 5; @@ -621,25 +623,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) vmsvga_update_rect_delayed(s, x, y, width, height); break; - case SVGA_CMD_RECT_FILL: - len -= 6; - if (len < 0) { - goto rewind; - } - - colour = vmsvga_fifo_read(s); - x = vmsvga_fifo_read(s); - y = vmsvga_fifo_read(s); - width = vmsvga_fifo_read(s); - height = vmsvga_fifo_read(s); -#ifdef HW_FILL_ACCEL - if (vmsvga_fill_rect(s, colour, x, y, width, height) == 0) { - break; - } -#endif - args = 0; - goto badcmd; - case SVGA_CMD_RECT_COPY: len -= 7; if (len < 0) { @@ -704,27 +687,52 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) #endif /* - * Other commands that we at least know the number of arguments - * for so we can avoid FIFO desync if driver uses them illegally. + * Deprecated commands are neither documented in VMware SVGA development kit + * nor in Linux kernel vmware-svga driver source code. + * If they are not encountered in real world scenarious, they should be + * completely removed. */ - case SVGA_CMD_DEFINE_ALPHA_CURSOR: + case SVGA_CMD_RECT_FILL: len -= 6; if (len < 0) { goto rewind; } - vmsvga_fifo_read(s); - vmsvga_fifo_read(s); - vmsvga_fifo_read(s); + + colour = vmsvga_fifo_read(s); x = vmsvga_fifo_read(s); y = vmsvga_fifo_read(s); - args = x * y; + width = vmsvga_fifo_read(s); + height = vmsvga_fifo_read(s); +#ifdef HW_FILL_ACCEL + if (vmsvga_fill_rect(s, colour, x, y, width, height) == 0) { + break; + } +#endif + args = 0; goto badcmd; + + /* + * Unimplemented commands that we gracefully skip their + * arguments so we can avoid FIFO desync + */ case SVGA_CMD_RECT_ROP_FILL: args = 6; goto badcmd; case SVGA_CMD_RECT_ROP_COPY: args = 7; goto badcmd; + case SVGA_CMD_DEFINE_ALPHA_CURSOR: + len -= 6; + if (len < 0) { + goto rewind; + } + vmsvga_fifo_read(s); + vmsvga_fifo_read(s); + vmsvga_fifo_read(s); + x = vmsvga_fifo_read(s); + y = vmsvga_fifo_read(s); + args = x * y; + goto badcmd; case SVGA_CMD_DRAW_GLYPH_CLIPPED: len -= 4; if (len < 0) { From patchwork Thu Aug 9 11:46:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561297 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 B954A157B for ; Thu, 9 Aug 2018 11:59:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3D932AE89 for ; Thu, 9 Aug 2018 11:59:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97A382AEB9; Thu, 9 Aug 2018 11:59: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=-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 17F982AE89 for ; Thu, 9 Aug 2018 11:59:26 +0000 (UTC) Received: from localhost ([::1]:50079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjbB-0007VT-BI for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:59:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPK-0004iO-VE for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPI-00073V-5D for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:10 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47914) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPH-00073F-R2 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:08 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BivQ2163150; Thu, 9 Aug 2018 11:47:06 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=lqiWefVTBKsNtGwi9yjv2AYEWEbXwvp+adxugaE4+4A=; b=iKds3tTnDNUAtJG14l0RtJTMrGwGH0ivxo+PfP/mhmRvMqi1Qvd5cG5QfUG1n6babOdo WVtflgtE+sj+wx8rjenTdRPjnWdZAMEwwVdEIep6oPl12IKLcy9RDbGNDvk6NN5a2Ehf QkBmt66hggWDSAzShmuK2EvyR5051WIqqEkC8antzFrLgWvYDB11SOBsib+3+camDgqi uUAsv/mx2EMHEfPHy6WleXItJ697uHtY5q4mQNELVMnalUOlF7nt2g2e10Ijs4Y4AE2R cFUd1AXetK1TOj/AVmAbUpgnIsgsd+LLqjKpcIyxTM9j10rC5lCdZYyiPktxtLzzak06 Sg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2kn1ndaxxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:06 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bl5qV005797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:05 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bl5j2030966; Thu, 9 Aug 2018 11:47:05 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:05 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:16 +0300 Message-Id: <1533815202-11967-4-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=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=870 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.79 Subject: [Qemu-devel] [PATCH 03/29] vmsvga: Explictly mark deprecated commands 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 These commands are neither mentioned nor documented in VMware SVGA development-kit and Linux vmware-svga driver source code. Thus, they should be subject to future deletion, if not encountered in practice. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 56 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index f8c5b64cfd7c..a244f43a866f 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -248,33 +248,33 @@ static const char *vmsvga_guest_id[] = { enum { SVGA_CMD_INVALID_CMD = 0, SVGA_CMD_UPDATE = 1, - SVGA_CMD_RECT_FILL = 2, + SVGA_CMD_RECT_FILL = 2, /* deprecated */ SVGA_CMD_RECT_COPY = 3, - SVGA_CMD_DEFINE_BITMAP = 4, - SVGA_CMD_DEFINE_BITMAP_SCANLINE = 5, - SVGA_CMD_DEFINE_PIXMAP = 6, - SVGA_CMD_DEFINE_PIXMAP_SCANLINE = 7, - SVGA_CMD_RECT_BITMAP_FILL = 8, - SVGA_CMD_RECT_PIXMAP_FILL = 9, - SVGA_CMD_RECT_BITMAP_COPY = 10, - SVGA_CMD_RECT_PIXMAP_COPY = 11, - SVGA_CMD_FREE_OBJECT = 12, - SVGA_CMD_RECT_ROP_FILL = 13, - SVGA_CMD_RECT_ROP_COPY = 14, - SVGA_CMD_RECT_ROP_BITMAP_FILL = 15, - SVGA_CMD_RECT_ROP_PIXMAP_FILL = 16, - SVGA_CMD_RECT_ROP_BITMAP_COPY = 17, - SVGA_CMD_RECT_ROP_PIXMAP_COPY = 18, + SVGA_CMD_DEFINE_BITMAP = 4, /* deprecated */ + SVGA_CMD_DEFINE_BITMAP_SCANLINE = 5, /* deprecated */ + SVGA_CMD_DEFINE_PIXMAP = 6, /* deprecated */ + SVGA_CMD_DEFINE_PIXMAP_SCANLINE = 7, /* deprecated */ + SVGA_CMD_RECT_BITMAP_FILL = 8, /* deprecated */ + SVGA_CMD_RECT_PIXMAP_FILL = 9, /* deprecated */ + SVGA_CMD_RECT_BITMAP_COPY = 10, /* deprecated */ + SVGA_CMD_RECT_PIXMAP_COPY = 11, /* deprecated */ + SVGA_CMD_FREE_OBJECT = 12, /* deprecated */ + SVGA_CMD_RECT_ROP_FILL = 13, /* deprecated */ + SVGA_CMD_RECT_ROP_COPY = 14, /* deprecated */ + SVGA_CMD_RECT_ROP_BITMAP_FILL = 15, /* deprecated */ + SVGA_CMD_RECT_ROP_PIXMAP_FILL = 16, /* deprecated */ + SVGA_CMD_RECT_ROP_BITMAP_COPY = 17, /* deprecated */ + SVGA_CMD_RECT_ROP_PIXMAP_COPY = 18, /* deprecated */ SVGA_CMD_DEFINE_CURSOR = 19, - SVGA_CMD_DISPLAY_CURSOR = 20, - SVGA_CMD_MOVE_CURSOR = 21, + SVGA_CMD_DISPLAY_CURSOR = 20, /* deprecated */ + SVGA_CMD_MOVE_CURSOR = 21, /* deprecated */ SVGA_CMD_DEFINE_ALPHA_CURSOR = 22, - SVGA_CMD_DRAW_GLYPH = 23, - SVGA_CMD_DRAW_GLYPH_CLIPPED = 24, + SVGA_CMD_DRAW_GLYPH = 23, /* deprecated */ + SVGA_CMD_DRAW_GLYPH_CLIPPED = 24, /* deprecated */ SVGA_CMD_UPDATE_VERBOSE = 25, - SVGA_CMD_SURFACE_FILL = 26, - SVGA_CMD_SURFACE_COPY = 27, - SVGA_CMD_SURFACE_ALPHA_BLEND = 28, + SVGA_CMD_SURFACE_FILL = 26, /* deprecated */ + SVGA_CMD_SURFACE_COPY = 27, /* deprecated */ + SVGA_CMD_SURFACE_ALPHA_BLEND = 28, /* deprecated */ SVGA_CMD_FRONT_ROP_FILL = 29, SVGA_CMD_FENCE = 30, }; @@ -692,7 +692,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) * If they are not encountered in real world scenarious, they should be * completely removed. */ - case SVGA_CMD_RECT_FILL: + case SVGA_CMD_RECT_FILL: /* deprecated */ len -= 6; if (len < 0) { goto rewind; @@ -715,10 +715,10 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) * Unimplemented commands that we gracefully skip their * arguments so we can avoid FIFO desync */ - case SVGA_CMD_RECT_ROP_FILL: + case SVGA_CMD_RECT_ROP_FILL: /* deprecated */ args = 6; goto badcmd; - case SVGA_CMD_RECT_ROP_COPY: + case SVGA_CMD_RECT_ROP_COPY: /* deprecated */ args = 7; goto badcmd; case SVGA_CMD_DEFINE_ALPHA_CURSOR: @@ -733,7 +733,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) y = vmsvga_fifo_read(s); args = x * y; goto badcmd; - case SVGA_CMD_DRAW_GLYPH_CLIPPED: + case SVGA_CMD_DRAW_GLYPH_CLIPPED: /* deprecated */ len -= 4; if (len < 0) { goto rewind; @@ -742,7 +742,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) vmsvga_fifo_read(s); args = 7 + (vmsvga_fifo_read(s) >> 2); goto badcmd; - case SVGA_CMD_SURFACE_ALPHA_BLEND: + case SVGA_CMD_SURFACE_ALPHA_BLEND: /* deprecated */ args = 12; goto badcmd; From patchwork Thu Aug 9 11:46:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561283 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 575D11057 for ; Thu, 9 Aug 2018 11:55:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45D7F2AED5 for ; Thu, 9 Aug 2018 11:55:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39B342AEE1; Thu, 9 Aug 2018 11:55:13 +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 5FB212AED5 for ; Thu, 9 Aug 2018 11:55:11 +0000 (UTC) Received: from localhost ([::1]:50054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjX4-0003iy-4s for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:55:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPN-0004ko-LG for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPL-00075j-2U for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:13 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36706) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPK-00075Q-Oz for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:10 -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 w79BiX19178063; Thu, 9 Aug 2018 11:47:09 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=5T19qxT2gU0iqZIVEcgtxYkNh5RFpbn/swl9iA0EVTM=; b=jqyXflVbdS2EpZtb0SaYimFZngWtjO69Z4r00ntvk6jMbEb31EDdDLDVO1kCORQ6hWUc CmxEpscUSy/M9Vf/mcYOupDvZLEovDp+3TStnWTT2bESCZpgUNh4m3yvrstJ5gdlfGpa aIXHeaAGhJez0phHJg5opIjejX4eyKVLx7eTu7pzYUejltS67zyTS0+Ger0HvibcWdkf cZcms9fvV9xgFKZLIUUtWEohm3He+17Yh0NfYmgWJAbA6G0T0uB52+ExBEZbqjgwMLyg 1nsLOR9G4JKtSFKW3fjbRGNw1ChVg0Ab2ChccgtMjIHAzU14qEhvvTyAlD2247IooYPL /g== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2kn43p2uvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:09 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bl8A3016517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:09 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79Bl8mb019798; Thu, 9 Aug 2018 11:47:08 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:07 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:17 +0300 Message-Id: <1533815202-11967-5-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 04/29] vmsvga: Do not print error message for ignored commands 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Future patches will add handling of commands that are parsed but deliberately ignored. This change adds required framework for avoiding printing parsing error messages for these commands, when we encounter them in the FIFO. Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index a244f43a866f..2e6ac5dfad8a 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -600,11 +600,13 @@ 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; + bool cmd_ignored; len = vmsvga_fifo_length(s); while (len > 0 && --maxloop > 0) { /* May need to go back to the start of the command if incomplete */ cmd_start = s->fifo_stop; + cmd_ignored = false; switch (cmd = vmsvga_fifo_read(s)) { @@ -759,6 +761,9 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) default: args = 0; + goto badcmd; + ignoredcmd: + cmd_ignored = true; badcmd: len -= args; if (len < 0) { @@ -767,8 +772,10 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) while (args--) { vmsvga_fifo_read(s); } - printf("%s: Unknown command 0x%02x in SVGA command FIFO\n", - __func__, cmd); + if (!cmd_ignored) { + printf("%s: Unknown command 0x%02x in SVGA command FIFO\n", + __func__, cmd); + } break; rewind: From patchwork Thu Aug 9 11:46:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561279 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 B24CD1057 for ; Thu, 9 Aug 2018 11:54:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DA2E2AED3 for ; Thu, 9 Aug 2018 11:54:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89B832AEF9; Thu, 9 Aug 2018 11:54:01 +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 018AD2AED3 for ; Thu, 9 Aug 2018 11:54:00 +0000 (UTC) Received: from localhost ([::1]:50048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjVv-0001rw-94 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:53:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPP-0004mi-I0 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPM-00076q-V7 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:15 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPM-00076H-Eu for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:12 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiGRS162726; Thu, 9 Aug 2018 11:47:11 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=CgrRG307gf3wsVvFyD74bA/0k6RUsUDRoZUiXSiMLaw=; b=AL/l7qctDBujKGK1HnsIXf4PiGhZPU0JH2iMx/YUxz8lEy7nqHn/41BT7TEm+Z5xCqhg qGNJboK3eZ4FWkjGoocpa70XNnDtPskNUY0fMlSlv3FMHzxsSRqCDah+MA+ZB2loY5Ql ieNrowgcTJ8HJDNvT5UaEQrKo5C/AfVmEd0MLcMzhmGqckycg8iVWrE2tIWCVDWdKqST /iPHyILhNyH0SdWvF2uuhu7yy0QZo+GSgVXtcdjwg61QEPsMGhExwTMDhQ+gATrKmcMc FylsaOvO9RD3IzzhSIKc0gQg63W5EGVclkUoNkt3vsiLCAsHSGCwhwvepxAoSX7A6EQi GA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2kn1ndaxxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:11 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlBkd020395 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:11 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 w79BlBTT004900; Thu, 9 Aug 2018 11:47:11 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:10 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:18 +0300 Message-Id: <1533815202-11967-6-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=953 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.79 Subject: [Qemu-devel] [PATCH 05/29] vmsvga: Show registers and commands on debug output as decimals 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 For better readability of debug output, show these values in decimal notation, as they are defined in source by decimal integers. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 2e6ac5dfad8a..2fbb9e7f6c9f 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -773,7 +773,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) vmsvga_fifo_read(s); } if (!cmd_ignored) { - printf("%s: Unknown command 0x%02x in SVGA command FIFO\n", + printf("%s: Unknown command %d in SVGA command FIFO\n", __func__, cmd); } break; @@ -964,7 +964,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) ret = s->scratch[s->index - SVGA_SCRATCH_BASE]; break; } - printf("%s: Bad register %02x\n", __func__, s->index); + printf("%s: Bad register %d\n", __func__, s->index); ret = 0; break; } @@ -1092,7 +1092,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) s->scratch[s->index - SVGA_SCRATCH_BASE] = value; break; } - printf("%s: Bad register %02x\n", __func__, s->index); + printf("%s: Bad register %d\n", __func__, s->index); } } From patchwork Thu Aug 9 11:46:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561291 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 C0B13139A for ; Thu, 9 Aug 2018 11:57:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABC7B2AED5 for ; Thu, 9 Aug 2018 11:57:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DFAF2AEE1; Thu, 9 Aug 2018 11:57:50 +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 414772AED5 for ; Thu, 9 Aug 2018 11:57:50 +0000 (UTC) Received: from localhost ([::1]:50065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjZd-00053f-Gk for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:57:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPS-0004on-O1 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPQ-00077n-5n for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:18 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPP-00077R-Sh for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:16 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiXDE138057; Thu, 9 Aug 2018 11:47:15 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=tnnKiaYxQJ3FobGzvwKVT/VVwhdhxQYZjcrw61UQA/M=; b=XlzSSmSY+Z+sN1n5P1lvLUPqsTPHqMlsFdUCKRC2crQSHNeioOthgB1Esq9BgJ2Y2m96 wwvVbsSzuXfslfrfEYXoxQJgMlun0fpmbgd7DZWBcM0P1mRjXvkDEZlW0wu2jtduN3go PJry0xuidmQ9eb4GR3hfjBpcuqHvvEL09FUlNCSmmc7jQwfcONOkt1GPTFpmRFq/KR5j ZZPCTzbi9PzaCqnEcGV6yQhkrhleowAYCQI1u8bOvMvqAyyAUb8BvAs/io/Lont64/BW D+j+XK9tJt2vlodstuc/33pIMLNQpp7kzyFTmVZwsd+FW+qbUFgYuhoEGPqreIZzFq2H tg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2kn4sq2s76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:14 +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 w79BlEAk006146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:14 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 w79BlEVe032729; Thu, 9 Aug 2018 11:47:14 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:13 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:19 +0300 Message-Id: <1533815202-11967-7-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.85 Subject: [Qemu-devel] [PATCH 06/29] vmsvga: Fix parse of SVGA_CMD_UPDATE_VERBOSE to consider additional opaque cookie 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 SVGA_CMD_UPDATE_VERBOSE has one more extra argument to fetch from command fifo, as compared to SVGA_CMD_UPDATE command. From Linux kernel drivers/gpu/drm/vmwgfx/device_include/svga_reg.h: "Just like SVGA_CMD_UPDATE, but also provide a per-rectangle 'reason' value, an opaque cookie which is used by internal debugging tools. Third party drivers should not use this command." Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 2fbb9e7f6c9f..d3a78809673d 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -611,8 +611,11 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) switch (cmd = vmsvga_fifo_read(s)) { /* Implemented commands */ - case SVGA_CMD_UPDATE: case SVGA_CMD_UPDATE_VERBOSE: + /* One extra word: an opaque cookie which is used for debugging */ + len -= 1; + /* fall through */ + case SVGA_CMD_UPDATE: len -= 5; if (len < 0) { goto rewind; @@ -622,6 +625,8 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) y = vmsvga_fifo_read(s); width = vmsvga_fifo_read(s); height = vmsvga_fifo_read(s); + if (cmd == SVGA_CMD_UPDATE_VERBOSE) + vmsvga_fifo_read(s); vmsvga_update_rect_delayed(s, x, y, width, height); break; 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 */ From patchwork Thu Aug 9 11:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561299 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 32E12157B for ; Thu, 9 Aug 2018 12:00:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 216E32AF39 for ; Thu, 9 Aug 2018 12:00:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 157D42AF17; Thu, 9 Aug 2018 12:00:28 +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 AE1752AF4D for ; Thu, 9 Aug 2018 12:00:27 +0000 (UTC) Received: from localhost ([::1]:50087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjcA-0000ud-8o for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:00:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPY-0004tf-BQ 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 1fnjPV-0007Ak-OQ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:24 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPV-0007Ab-Dv for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:21 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiRDo138023; Thu, 9 Aug 2018 11:47:20 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=zhKlFiBIj/XEyNXKZDX5hXsnz3k/7mq0uY6Oyjeb8dU=; b=gCat1s5IV3aXPtzKNMIxus0C8rsNsYQ2CjykxHg8xTmSfQG5pyoNQeFqMpF8Vw7qDYKz bLu5qf8b90U/KT2EM5LevQqLJOpWKCvJNVfh2O3sJYP6Y0j1JGCQqJIO6q4qFcYkTowE 9qdlSqNIeXjH/yPJ1vsp12tWxTtH/IWQgfPY0aBPfrUq4CO/Nzr2J9d3ZVvlb+OJklpl Ux5Ui4vZduosnZ4KCshCFUWUyh2rujVsPov9NeOUtEiyKbpdHp7so3tL+GEoQ4g235LM saaByiwQ2wdgKVcyZtw0aDDOSCwCuIKhOLUuJ20MjqjbqP23OBTGOHhvoBmJYOiCB1Yb Qw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2kn4sq2s7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:20 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlJ66006307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:20 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlJPM031053; Thu, 9 Aug 2018 11:47:19 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:19 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:21 +0300 Message-Id: <1533815202-11967-9-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.85 Subject: [Qemu-devel] [PATCH 08/29] vmsvga: Parse SVGA_CMD_FENCE command to avoid FIFO desync 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index fab6443a87e2..675c8755ab48 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -760,6 +760,9 @@ 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: + args = 1; + goto badcmd; /* * Other commands that are not listed as depending on any @@ -767,7 +770,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) */ case SVGA_CMD_SURFACE_FILL: case SVGA_CMD_SURFACE_COPY: - case SVGA_CMD_FENCE: case SVGA_CMD_INVALID_CMD: break; /* Nop */ From patchwork Thu Aug 9 11:46:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561277 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 C84451057 for ; Thu, 9 Aug 2018 11:53:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B301129D99 for ; Thu, 9 Aug 2018 11:53:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A70E629E43; Thu, 9 Aug 2018 11:53:02 +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 4EAC529D99 for ; Thu, 9 Aug 2018 11:53:02 +0000 (UTC) Received: from localhost ([::1]:50045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjUz-00015B-IV for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:53:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPb-0004tm-Uj for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPZ-0007Cj-B0 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:27 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPZ-0007CN-0I for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:25 -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 w79BiaXW178074; Thu, 9 Aug 2018 11:47:24 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=4o//vR9K5z9omKMhR2P+s7lUP9PQqo7koT6pHEdlb8U=; b=VhJ0tNEnOvW6cytPvA0xomM7ZTuMcGMlrwqmk5RIuGFgaSDY95mgyCwVrINAiuBnrfRa j2Y8dl65dEGPJd++QFE8wU9uxVH7j6dMHGvc3nFl40wbLPsh5d3a1JxFfHHbLQ3d40eU fk4q7ioKUPzTv40BJxQbZeOif+sUwPvhpUHmYEleOCQXnKpe5iTpEwv591TxzNUxWSFA z99GPYk0pqPmvVEwmpFwd7X7gxxv6zUDIUWm2TTPQrFGAsUz8wo6fhhNvy9xdw4wR8bk qqf+jldLIRt5Un2OFWd3W4NOMp4rMcAwwYiNV5UGFJIM4I4C1cF7DZweCyqoFm/j0ikk 2g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2kn43p2uwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:23 +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 w79BlNit006401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:23 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 w79BlMHR032750; Thu, 9 Aug 2018 11:47:22 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:22 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:22 +0300 Message-Id: <1533815202-11967-10-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=894 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 09/29] vmsvga: Account for length of command word when parsing commands 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 While we continue to ignore SVGA_CMD_RECT_ROP_FILL, SVGA_CMD_RECT_ROP_COPY and SVGA_CMD_FENCE commands, we should account for command length, not only arguments following command code. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 675c8755ab48..b32a625ae9c2 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -731,9 +731,17 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) * arguments so we can avoid FIFO desync */ case SVGA_CMD_RECT_ROP_FILL: /* deprecated */ + len -= 1; + if (len < 0) { + goto rewind; + } args = 6; goto badcmd; case SVGA_CMD_RECT_ROP_COPY: /* deprecated */ + len -= 1; + if (len < 0) { + goto rewind; + } args = 7; goto badcmd; case SVGA_CMD_DEFINE_ALPHA_CURSOR: @@ -761,6 +769,10 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) args = 12; goto badcmd; case SVGA_CMD_FENCE: + len -= 1; + if (len < 0) { + goto rewind; + } args = 1; goto badcmd; From patchwork Thu Aug 9 11:46:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561287 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 2C622139A for ; Thu, 9 Aug 2018 11:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 181FD2AED5 for ; Thu, 9 Aug 2018 11:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B4C62AEE1; Thu, 9 Aug 2018 11:56:44 +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 AF4D52AED5 for ; Thu, 9 Aug 2018 11:56:43 +0000 (UTC) Received: from localhost ([::1]:50056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjYY-0003tx-T0 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:56:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPe-0004wu-Bg for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPb-0007DG-OO for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:30 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPb-0007Cy-CY for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:27 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiRVx138020; Thu, 9 Aug 2018 11:47:26 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=qzdO2VLgeE++ZuASNXgevLWqYRP3XE+rVWDFSAGobBw=; b=g0Q5LZ61SqB5UFbp6dHvjnR6WJrV+II3QT8UXRNfPSgvBqxYXq6cdcFrg4kcy0lSy95H e73h3eza+KeoUfeH5HunVh+92TQ4fmpGiGPaZClpeKQgDiH7TJVsiCBpjLsTtVpmOMch 25x4DJ9vB0/s6Sx/x5I3GhfYE2udOWp3RatqsjAWAdbxOoanyGk91GkNV+j/LwGAuelT SgWwahTDfPflg+H1YNPSESLTKBW0erK9WF/LkVUonR1BV4F2fsxpx0EHNT5K/vN1fIMK qQ4IeD8IOxxU19294ZuuPCxz/5NkkbUqN1f9Y17tLkBaP65tLR5AkyN2PQIqHVoa4ro1 2A== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2kn4sq2s7u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:26 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlPhI006491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:26 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79BlPEW019913; Thu, 9 Aug 2018 11:47:25 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:25 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:23 +0300 Message-Id: <1533815202-11967-11-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=998 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.85 Subject: [Qemu-devel] [PATCH 10/29] vmsvga: Remove treatment of deprecated commands as Nop 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 Remove switch-case invalid handling of SVGA_CMD_SURFACE_FILL and SVGA_CMD_SURFACE_COPY deprecated commands as their handling is obviously not complete. We'd rather leave it to default (unknown) command handling and have an error message displayed. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index b32a625ae9c2..c30ae9b4b204 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -780,8 +780,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) * Other commands that are not listed as depending on any * CAPABILITIES bits, but are not described in the README either. */ - case SVGA_CMD_SURFACE_FILL: - case SVGA_CMD_SURFACE_COPY: case SVGA_CMD_INVALID_CMD: break; /* Nop */ From patchwork Thu Aug 9 11:46:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561313 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 0B75313AC for ; Thu, 9 Aug 2018 12:05:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC94222B1F for ; Thu, 9 Aug 2018 12:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E02BB2AED2; Thu, 9 Aug 2018 12:05:37 +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 9164622B1F for ; Thu, 9 Aug 2018 12:05:37 +0000 (UTC) Received: from localhost ([::1]:50117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjhA-0005Pk-Ln for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:05:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPh-00050t-6V for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPe-0007E2-L2 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:33 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPe-0007Dd-Ak for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:30 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiRW0138020; Thu, 9 Aug 2018 11:47:29 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=9vCfW6WRs9Wfwl90ubmjrc2I10YFgDTr5R8j4a129ZQ=; b=ETedeR+w98otlbxMkLO983aDo8xGCc2mTqOJNRwvH0pM9aOkk3Y2gA68arlOhQ8XtXm6 p0Oni+zyB8qkinFpiyMw5WXUCQehEV69FSmMySvpLpgyYErf7teLygt/uh86lXVAVUQE D+TtCrwqEXCYUaStgMXX+iirOQWr2sMUAkLuupYaVBQjY0a7jniKXqvmKDGq6iU7Y9W2 sMG8rRP+ongvrxPjeENOlVfpscUMR3Nual+whYyMBZlNDLh9Ib79UnGgn/v/DT5amJVw 0fYQrtsXLrYb27QsnawODRk4ziFESRzCoGZ8zaONzHW3ev/26b//VDsvXKlA4Qd3+XCN 7A== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2kn4sq2s7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:29 +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 w79BlSXZ006554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:28 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 w79BlSrI005122; Thu, 9 Aug 2018 11:47:28 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:28 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:24 +0300 Message-Id: <1533815202-11967-12-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=834 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.85 Subject: [Qemu-devel] [PATCH 11/29] vmsvga: Remove handler of SVGA_CMD_INVALID_CMD 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 This should be better handled by switch default case, which will output debugging message about encountering this command, instead of silently discarding. If such command is ever encountered, it serves as indicator of broken FIFO command decoding chain. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index c30ae9b4b204..f0e6b4bc74ba 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -776,13 +776,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) args = 1; goto badcmd; - /* - * Other commands that are not listed as depending on any - * CAPABILITIES bits, but are not described in the README either. - */ - case SVGA_CMD_INVALID_CMD: - break; /* Nop */ - default: args = 0; goto badcmd; From patchwork Thu Aug 9 11:46:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561295 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 CA030139A for ; Thu, 9 Aug 2018 11:59:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B53452AEAA for ; Thu, 9 Aug 2018 11:59:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A98822AEB3; Thu, 9 Aug 2018 11:59: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=-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 02BE02AE8D for ; Thu, 9 Aug 2018 11:59:21 +0000 (UTC) Received: from localhost ([::1]:50072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjb6-0006LY-5z for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:59:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPk-000542-I4 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPh-0007FO-TY for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34222) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPh-0007Ej-JQ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:33 -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 w79BiQMA145707; Thu, 9 Aug 2018 11:47:32 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=iTd362jt7egGZjlgzXCppOrgG4Hnoom22JQGmAl9Dcg=; b=a5O7n3+bUf9f07rc+HphDnvxBD56YUMEHKkYw+mrjq7q5q3Dq4sjasEPQ0twAz3uPzae 151SWIYeDV0lR8WQIYP5LElk9PoEKEP43RGli8KmYGx9o8sdE+SDm/COhkebIvVoLQzR DymB9TcO9hHmoEp9TI1WZbkrK5zC9BWJOAdrtiex6pVOKsIlfaQm5L4n6TKBDpfC3ZcL js7PunKXYtSz/tdhoIXi0nCbAWKSF3VF8SnGwCGLmQZgPNC3cYTUOE14/nxDipJ4ZWKJ /BFH5yGPErv4nPHHMJZcWB0PYWyKymEeZrMklaOsko94ou5cvss3Sd7xOmDEkpNqvVCu cw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kn3jtav5y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:32 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlWwr012024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:32 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 w79BlVqR000325; Thu, 9 Aug 2018 11:47:31 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:31 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:25 +0300 Message-Id: <1533815202-11967-13-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 12/29] vmsvga: Add definitions of FIFO registers and report their number 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 Import FIFO register definitions from VMware SVGA Device Developer Kit. Report number of available registers so that guest device driver can reserve enough space for registers before command FIFO. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 5 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index f0e6b4bc74ba..8eeb0efc9cab 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -76,6 +76,8 @@ struct vmsvga_state_s { int x, y, w, h; } redraw_fifo[REDRAW_FIFO_LEN]; int redraw_fifo_first, redraw_fifo_last; + + uint32_t num_fifo_regs; }; #define TYPE_VMWARE_SVGA "vmware-svga" @@ -194,14 +196,124 @@ enum { SVGA_FIFO_NEXT, SVGA_FIFO_STOP, - /* - * Additional offsets added as of SVGA_CAP_EXTENDED_FIFO - */ + /* + * Block 2 (extended registers): Mandatory registers for the extended + * FIFO. These exist if the SVGA caps register includes + * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their + * associated capability bit is enabled. + * + * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied + * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE. + * This means that the guest has to test individually (in most cases + * using FIFO caps) for the presence of registers after this; the VMX + * can define "extended FIFO" to mean whatever it wants, and currently + * won't enable it unless there's room for that set and much more. + */ + SVGA_FIFO_CAPABILITIES = 4, SVGA_FIFO_FLAGS, SVGA_FIFO_FENCE, - SVGA_FIFO_3D_HWVERSION, - SVGA_FIFO_PITCHLOCK, + + /* + * Block 3a (optional extended registers): Additional registers for the + * extended FIFO, whose presence isn't actually implied by + * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to + * leave room for them. + * + * These in block 3a, the VMX currently considers mandatory for the + * extended FIFO. + */ + + /* Valid if exists (i.e. if extended FIFO enabled): */ + SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */ + /* Valid with SVGA_FIFO_CAP_PITCHLOCK: */ + SVGA_FIFO_PITCHLOCK, + + /* Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: */ + SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */ + SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */ + SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */ + SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */ + SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */ + + /* Valid with SVGA_FIFO_CAP_RESERVE: */ + SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */ + + /* + * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2: + * + * By default this is SVGA_ID_INVALID, to indicate that the cursor + * coordinates are specified relative to the virtual root. If this + * is set to a specific screen ID, cursor position is reinterpreted + * as a signed offset relative to that screen's origin. + */ + SVGA_FIFO_CURSOR_SCREEN_ID, + + /* + * Valid with SVGA_FIFO_CAP_DEAD + * + * An arbitrary value written by the host, drivers should not use it. + */ + SVGA_FIFO_DEAD, + + /* + * Valid with SVGA_FIFO_CAP_3D_HWVERSION_REVISED: + * + * Contains 3D HWVERSION (see SVGA3dHardwareVersion in svga3d_reg.h) + * on platforms that can enforce graphics resource limits. + */ + SVGA_FIFO_3D_HWVERSION_REVISED, + + /* + * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new + * registers, but this must be done carefully and with judicious use of + * capability bits, since comparisons based on SVGA_FIFO_MIN aren't + * enough to tell you whether the register exists: we've shipped drivers + * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of + * the earlier ones. The actual order of introduction was: + * - PITCHLOCK + * - 3D_CAPS + * - CURSOR_* (cursor bypass 3) + * - RESERVED + * So, code that wants to know whether it can use any of the + * aforementioned registers, or anything else added after PITCHLOCK and + * before 3D_CAPS, needs to reason about something other than + * SVGA_FIFO_MIN. + */ + + /* + * 3D caps block space; valid with 3D hardware version >= + * SVGA3D_HWVERSION_WS6_B1. + */ + SVGA_FIFO_3D_CAPS = 32, + SVGA_FIFO_3D_CAPS_LAST = 32 + 255, + + /* + * End of VMX's current definition of "extended-FIFO registers". + * Registers before here are always enabled/disabled as a block; either + * the extended FIFO is enabled and includes all preceding registers, or + * it's disabled entirely. + * + * Block 3b (truly optional extended registers): Additional registers for + * the extended FIFO, which the VMX already knows how to enable and + * disable with correct granularity. + * + * Registers after here exist if and only if the guest SVGA driver + * sets SVGA_FIFO_MIN high enough to leave room for them. + */ + + /* Valid if register exists: */ + SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */ + SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */ + SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */ + + /* + * Always keep this last. This defines the maximum number of + * registers we know about. At power-on, this value is placed in + * the SVGA_REG_MEM_REGS register, and we expect the guest driver + * to allocate this much space in FIFO memory for registers. + */ + SVGA_FIFO_NUM_REGS }; #define SVGA_FIFO_CAP_NONE 0 @@ -969,6 +1081,9 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) break; case SVGA_REG_MEM_REGS: + ret = s->num_fifo_regs; + break; + case SVGA_REG_NUM_DISPLAYS: case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: @@ -1268,6 +1383,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s, memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size, &error_fatal); s->fifo = (uint32_t *)memory_region_get_ram_ptr(&s->fifo_ram); + s->num_fifo_regs = SVGA_FIFO_NUM_REGS; vga_common_init(&s->vga, OBJECT(dev)); vga_init(&s->vga, OBJECT(dev), address_space, io, true); From patchwork Thu Aug 9 11:46:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561303 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 619B7174A for ; Thu, 9 Aug 2018 12:02:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F2322AF03 for ; Thu, 9 Aug 2018 12:02:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42FEC2AF43; Thu, 9 Aug 2018 12:02:24 +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 DF3382AF03 for ; Thu, 9 Aug 2018 12:02:23 +0000 (UTC) Received: from localhost ([::1]:50099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnje3-0002J3-3r for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:02:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPn-00056o-Al for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPk-0007I7-MJ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:39 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPk-0007Hg-CA for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:36 -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 w79Bix7A146166; Thu, 9 Aug 2018 11:47:35 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=N+gYT4zrJ+gGsyQMC8/49gH9LDWh1AVJGGYysQlhJt4=; b=JN67msCGwyRxzzNzN/9pjqcEb3eiB+xhixEIDPAzqJvClPX+Nge/XNHuQ2TY+OUxkDYz wqzO+V7Qe+dlFzn39XTLlSe/PRqzma0xdzbpDXkoE9NeGo5DvJ65DFDK3bE4jMBgsdpO 0JyZuyWsHclkuSqKkxps/bpD10hKML2RQ4Uj7AFmM3AM6OOvns5GU7jph1pGwQfFpYuJ dCfy1+qxit/O4SfN2R4d7sAoO9mr75kd2QiLdDflElyE7Q3VnIXYzvBk2ls8LuQuLUFZ 2mXEq3bhWCBHsEcLArFGPevd4Cs06+vL7k8Cmo9NXw7ibe7APjFfjg1wANvxXSE5xKWy Iw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2kn3jtav65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:35 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlYxk017268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:34 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlYQd031235; Thu, 9 Aug 2018 11:47:34 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:34 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:26 +0300 Message-Id: <1533815202-11967-14-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=423 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 13/29] vmsvga: Add support for extended FIFO registers 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Supporting extended FIFO registers is required to support SVGA_FIFO_FENCE which allows guest to receive interrupt when FIFO is processed up to a specified fence. Thus, as a preperation for supporting SVGA_FIFO_FENCE, add extened FIFO registers support. Note that exposing SVGA_CAP_EXTENDED_FIFO requires to support the following registers: SVGA_FIFO_CAPABILITIES, SVGA_FIFO_FLAGS and SVGA_FIFO_3D_HWVERSION. For more information on how SVGA_FIFO_3D_HWVERSION is negoitated, see SVGA3D_Init() in VMware SVGA development kit. Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 8eeb0efc9cab..91f990544e14 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1033,6 +1033,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) SVGA_CAP_CURSOR_BYPASS; } #endif + caps |= SVGA_CAP_EXTENDED_FIFO; ret = caps; break; @@ -1138,6 +1139,8 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) } else { vga_dirty_log_start(&s->vga); } + if (s->enable) + s->fifo[SVGA_FIFO_3D_HWVERSION] = 0; /* 3D disabled */ break; case SVGA_REG_WIDTH: @@ -1384,6 +1387,8 @@ 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_FLAGS] = 0; vga_common_init(&s->vga, OBJECT(dev)); vga_init(&s->vga, OBJECT(dev), address_space, io, true); From patchwork Thu Aug 9 11:46:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561307 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 75D2B14E2 for ; Thu, 9 Aug 2018 12:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DD5C2AED2 for ; Thu, 9 Aug 2018 12:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51E262AF5B; Thu, 9 Aug 2018 12:03:42 +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 EB70A2AED2 for ; Thu, 9 Aug 2018 12:03:41 +0000 (UTC) Received: from localhost ([::1]:50098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjfJ-00027L-6G for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:03:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPp-00059K-R1 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPn-0007LB-7n for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:41 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37012) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPm-0007J4-Sb for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:39 -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 w79BiHpP177972; Thu, 9 Aug 2018 11:47:37 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=dy6T56qP9t2QUqWypAebFhp6yQSnA75LqO2MQ7Q2iwE=; b=RGALTfE6PbbX56kb4ecyOdVuJKZ81l0SXvbwADsDsr04kKFIW8LqUIz0xZDqEDP4f78/ H9BQ7k+5tHjwRpofA8jkcvbP3+fmuo3mXafZJiveacDI8+sdnyMyuVZ/JGDaI6hvkz3X lHiwO/TMYb62c95d5pLplE15gLWGMiKWWX9gy33QtUnHgRpC/DEWYlIgE9ehDtrKq6JS ICCe1AzHitd9NFLQmdyIXgHjhGSvkzqheNbOYQUK/BY9/4PfyYF4P9vxiS97hhOL6Max buO0X68Gv9Xa6ARBQL/dOx/jAlMZD/xg1pM4aik8JytxtHNS5JsRaKBGZU+LlYcn3bqi Ng== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2kn43p2uxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:37 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlbMq021259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:37 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlblQ031246; Thu, 9 Aug 2018 11:47:37 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:36 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:27 +0300 Message-Id: <1533815202-11967-15-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=725 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 14/29] vmsvga: Setup interrupt pin 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 This is necessary in order for device to raise interrupts. Future patches will add functionality to device which will need this ability. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 91f990544e14..eae3f1455445 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1447,6 +1447,7 @@ static void pci_vmsvga_realize(PCIDevice *dev, Error **errp) dev->config[PCI_CACHE_LINE_SIZE] = 0x08; dev->config[PCI_LATENCY_TIMER] = 0x40; dev->config[PCI_INTERRUPT_LINE] = 0xff; /* End */ + dev->config[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */ memory_region_init_io(&s->io_bar, NULL, &vmsvga_io_ops, &s->chip, "vmsvga-io", 0x10); From patchwork Thu Aug 9 11:46:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561321 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 7D586157B for ; Thu, 9 Aug 2018 12:08:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00F4E2A5AD for ; Thu, 9 Aug 2018 12:08:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8F1F2A484; Thu, 9 Aug 2018 12:08:23 +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 41DA02A484 for ; Thu, 9 Aug 2018 12:08:23 +0000 (UTC) Received: from localhost ([::1]:50128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjjq-0007sc-6A for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:08:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPt-0005C8-3G for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPq-0007Ot-Er for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:45 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34316) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPq-0007Nx-58 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:42 -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 w79BiKiu145690; Thu, 9 Aug 2018 11:47:41 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=cYHYk4Hf6M72ZUOS/Ddiab6WOYLRTB7AHXFvWVIHouo=; b=wkFXd9jYHdKM2/PxnJq/6eiGsgm8z4xKXs2G6RiKIg3jk+W5qc7jZQmu61Fdcm1n3pxj I5lv/ylqzMqLIvybPdmFoftkKFq6VkEemp0ON+hvb8i+yuezodOW99555ew//geP/Isk jnMkEmWXm1U2X89K264TmX+hZ+j/LspxqJEAcvcH8hEH1IQkwz82aLwgklLrkJ5EvTVb +OdLz56cqs8pW258a2KYyiwKiQKJtPoaK4ioz2nzJmseyIBk6we+tT237xt9zo32c8mp vTjyUgFmPLVg+quAZj8KK2KEDVde7UbFlVfoP9jS995oRJ9PZVyDypfcR8Bymz0N4BPa ww== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kn3jtav6e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:41 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79BleGQ012232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:40 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79Ble1w031258; Thu, 9 Aug 2018 11:47:40 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:39 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:28 +0300 Message-Id: <1533815202-11967-16-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 15/29] vmsvga: Add interrupt mask and status registers 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 Add missing functionality of interrupt mask and status registers. Writing to interrupt status register clears interrupt request. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index eae3f1455445..4e4f6f8eec42 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -78,6 +78,8 @@ struct vmsvga_state_s { int redraw_fifo_first, redraw_fifo_last; uint32_t num_fifo_regs; + uint32_t irq_mask; + uint32_t irq_status; }; #define TYPE_VMWARE_SVGA "vmware-svga" @@ -104,6 +106,7 @@ struct pci_vmsvga_state_s { #define SVGA_INDEX_PORT 0x0 #define SVGA_VALUE_PORT 0x1 #define SVGA_BIOS_PORT 0x2 +#define SVGA_IRQSTATUS_PORT 0x8 #define SVGA_VERSION_2 @@ -158,6 +161,7 @@ enum { SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */ SVGA_REG_NUM_DISPLAYS = 31, /* Number of guest displays */ SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ + SVGA_REG_IRQMASK = 33, /* Interrupt mask */ SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ SVGA_PALETTE_END = SVGA_PALETTE_BASE + 767, @@ -183,6 +187,7 @@ enum { #define SVGA_CAP_EXTENDED_FIFO (1 << 15) #define SVGA_CAP_MULTIMON (1 << 16) #define SVGA_CAP_PITCHLOCK (1 << 17) +#define SVGA_CAP_IRQMASK (1 << 18) /* * FIFO offsets (seen as an array of 32-bit words) @@ -1034,6 +1039,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) } #endif caps |= SVGA_CAP_EXTENDED_FIFO; + caps |= SVGA_CAP_IRQMASK; ret = caps; break; @@ -1091,6 +1097,10 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) ret = 0; break; + case SVGA_REG_IRQMASK: + ret = s->irq_mask; + break; + default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) { @@ -1221,6 +1231,10 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: break; + case SVGA_REG_IRQMASK: + s->irq_mask = value; + break; + default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) { @@ -1231,6 +1245,28 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) } } +static uint32_t vmsvga_irqstatus_read(void *opaque, uint32_t address) +{ + struct vmsvga_state_s *s = opaque; + return s->irq_status; +} + +static void vmsvga_irqstatus_write(void *opaque, uint32_t address, uint32_t data) +{ + struct vmsvga_state_s *s = opaque; + struct pci_vmsvga_state_s *pci_vmsvga = + container_of(s, struct pci_vmsvga_state_s, chip); + PCIDevice *pci_dev = PCI_DEVICE(pci_vmsvga); + + /* + * Clear selected interrupt sources and lower + * interrupt request when none are left active + */ + s->irq_status &= ~data; + if (!s->irq_status) + pci_set_irq(pci_dev, 0); +} + static uint32_t vmsvga_bios_read(void *opaque, uint32_t address) { printf("%s: what are we supposed to return?\n", __func__); @@ -1298,6 +1334,8 @@ static void vmsvga_reset(DeviceState *dev) s->redraw_fifo_first = 0; s->redraw_fifo_last = 0; s->syncing = 0; + s->irq_mask = 0; + s->irq_status = 0; vga_dirty_log_start(&s->vga); } @@ -1327,12 +1365,18 @@ static int vmsvga_post_load(void *opaque, int version_id) struct vmsvga_state_s *s = opaque; s->invalidated = 1; + + if (version_id < 1) { + s->irq_mask = 0; + s->irq_status = 0; + } + return 0; } static const VMStateDescription vmstate_vmware_vga_internal = { .name = "vmware_vga_internal", - .version_id = 0, + .version_id = 1, .minimum_version_id = 0, .post_load = vmsvga_post_load, .fields = (VMStateField[]) { @@ -1352,6 +1396,8 @@ static const VMStateDescription vmstate_vmware_vga_internal = { VMSTATE_UINT32(svgaid, struct vmsvga_state_s), VMSTATE_INT32(syncing, struct vmsvga_state_s), VMSTATE_UNUSED(4), /* was fb_size */ + VMSTATE_UINT32_V(irq_mask, struct vmsvga_state_s, 1), + VMSTATE_UINT32_V(irq_status, struct vmsvga_state_s, 1), VMSTATE_END_OF_LIST() } }; @@ -1404,6 +1450,7 @@ static uint64_t vmsvga_io_read(void *opaque, hwaddr addr, unsigned size) case SVGA_IO_MUL * SVGA_INDEX_PORT: return vmsvga_index_read(s, addr); case SVGA_IO_MUL * SVGA_VALUE_PORT: return vmsvga_value_read(s, addr); case SVGA_IO_MUL * SVGA_BIOS_PORT: return vmsvga_bios_read(s, addr); + case SVGA_IO_MUL * SVGA_IRQSTATUS_PORT: return vmsvga_irqstatus_read(s, addr); default: return -1u; } } @@ -1423,6 +1470,9 @@ static void vmsvga_io_write(void *opaque, hwaddr addr, case SVGA_IO_MUL * SVGA_BIOS_PORT: vmsvga_bios_write(s, addr, data); break; + case SVGA_IO_MUL * SVGA_IRQSTATUS_PORT: + vmsvga_irqstatus_write(s, addr, data); + break; } } From patchwork Thu Aug 9 11:46:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561311 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 44ABC157B for ; Thu, 9 Aug 2018 12:05:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DFB422B1F for ; Thu, 9 Aug 2018 12:05:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F6F72AED2; Thu, 9 Aug 2018 12:05:31 +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 8C30122B1F for ; Thu, 9 Aug 2018 12:05:30 +0000 (UTC) Received: from localhost ([::1]:50116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjh3-00055y-7d for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:05:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPw-0005FG-Ew for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPt-0007U6-R4 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:48 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48316) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPt-0007SX-Gv for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:45 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BivQ5163150; Thu, 9 Aug 2018 11:47:44 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=9zzy40spjoQ+Qk2o4xymV6uXlEkMX0GO/cv79+IaSZ4=; b=RRzSgPWdMvmzXJ9qXZZn/8cRolmJBKFYZnNzh5qLypI9ZQkR/3qnCK9e5NA+wSuveTag cXre/FHBDIYMYR3adf+uuEJlaL0dXXVyZHBGNeb3MP2liZR4H1rEdawKg+xqbHZk4W4w u7GDzLdiw55TYLItPpU4+828KZUc3qLuG91DgGHTMnLrklrr8brm1nEwlzOifonE5gtk D+RjINcIZjYK3lnTgh88rfJQztIoUFCfych5WT02yASY4Tf4B+4+fdmZhZKnE/mfwZK6 c+mNP17w98/0nehJyEwR9h5Uzr6QX4PSk8XzF900/xBE8L92cuGZ9X+uKsDEcTdiwm8e Ig== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2kn1nday0e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:44 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79Blht1021433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:44 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79BlhHj020058; Thu, 9 Aug 2018 11:47:43 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:42 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:29 +0300 Message-Id: <1533815202-11967-17-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.79 Subject: [Qemu-devel] [PATCH 16/29] vmsvga: Add framework code for SVGA command to raise interrupt 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 Should not change semantics. This is done as a preparation for future patches. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 4e4f6f8eec42..ce5b8814ac91 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -718,6 +718,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) struct vmsvga_cursor_definition_s cursor; uint32_t cmd_start; bool cmd_ignored; + bool irq_pending = false; len = vmsvga_fifo_length(s); while (len > 0 && --maxloop > 0) { @@ -920,6 +921,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) } s->syncing = 0; + + /* Need to raise irq ? */ + if (irq_pending && (s->irq_status & s->irq_mask)) { + struct pci_vmsvga_state_s *pci_vmsvga + = container_of(s, struct pci_vmsvga_state_s, chip); + pci_set_irq(PCI_DEVICE(pci_vmsvga), 1); + } } static uint32_t vmsvga_index_read(void *opaque, uint32_t address) From patchwork Thu Aug 9 11:46:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561319 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 7F614157B for ; Thu, 9 Aug 2018 12:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A29BC2A41F for ; Thu, 9 Aug 2018 12:08:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 967092A465; Thu, 9 Aug 2018 12:08:14 +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 423EB2A41F for ; Thu, 9 Aug 2018 12:08:14 +0000 (UTC) Received: from localhost ([::1]:50122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjjh-0006gL-85 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:08:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjPz-0005GR-8Y for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjPw-0007V9-L0 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:51 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48350) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPw-0007Uq-BB for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:48 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BivSi163179; Thu, 9 Aug 2018 11:47:47 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=VHVFyfUuPCRTWX/+ptkFcoNL/21aoRJWKrZI21a0RS4=; b=fZX4lGIkXjDgfFXCHgpPgrvUJNzo5HTHabV7gylQ5mOmL7W2ebDQPPbrmyOwxqut0PVo kADcvfAIY9n2NodFU8cGF5fevMTqmyQFW8UcSPUMVxqt8UaQdPAv3VYPjyFs5R+UDvfv RswEC88GUjbahNw4xWzz5giMk/RhCqQVnqu4rNkY9B53neS9PFb3dHiHBpiqfl0acF9f o4mBcJWjCzvkGbAQD7ya/4Sh6ZOOPrf21bU2BJv42tCSYVJU0i/DUl7f0PjmtF/FhMb8 sgs9Gc2eyXJr/M55hyK/WVYsrzEAAxmPjqlwuQaZGFsStnfGofoXGkiKILIMyRBdPaDD /Q== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2kn1nday0h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:47 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79Blk5j021545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:46 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 w79BlkM9000419; Thu, 9 Aug 2018 11:47:46 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:45 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:30 +0300 Message-Id: <1533815202-11967-18-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=838 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.79 Subject: [Qemu-devel] [PATCH 17/29] vmsvga: Define interrupt source flags for interrupt status and mask registers 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 Based on Linux kernel drivers/gpu/drm/vmwgfx/device_include/svga_reg.h. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index ce5b8814ac91..597051ec5c92 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -334,6 +334,18 @@ enum { #define SVGA_MAX_WIDTH ROUND_UP(2360, VNC_DIRTY_PIXELS_PER_BIT) #define SVGA_MAX_HEIGHT 1770 +/* + * Interrupt source flags for IRQSTATUS_PORT and IRQMASK. + * + * Interrupts are only supported when the + * SVGA_CAP_IRQMASK capability is present. + */ +#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */ +#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */ +#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */ +#define SVGA_IRQFLAG_COMMAND_BUFFER 0x8 /* Command buffer completed */ +#define SVGA_IRQFLAG_ERROR 0x10 /* Error while processing commands */ + #ifdef VERBOSE # define GUEST_OS_BASE 0x5001 static const char *vmsvga_guest_id[] = { From patchwork Thu Aug 9 11:46:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561327 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 00134157B for ; Thu, 9 Aug 2018 12:11:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E16092A450 for ; Thu, 9 Aug 2018 12:11:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D56F12AF42; Thu, 9 Aug 2018 12:11:09 +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 7F6162A450 for ; Thu, 9 Aug 2018 12:11:09 +0000 (UTC) Received: from localhost ([::1]:50146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjmW-00027U-N5 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:11:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQ1-0005It-Qs 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 1fnjPz-0007Vs-7p for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:53 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjPy-0007Vb-RQ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:51 -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 w79Bif4P146062; Thu, 9 Aug 2018 11:47:49 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=c/bQW52I37G8+7kUgvkWOH1UtRFQTgRDqdTOVUSOmX0=; b=o0lY2ym6+AdrXc00Bbs5RT+NRezIGgX1OoeSYW0ko4ndGmJEbBSkHNVkGhN5D9ybOzV1 4cP/4jMsCtYkT385XGKF0fkN+2fZkxBhaR+nmBuKLbD6P4vmSXUvNGpWZraq1HmuRdif 1bekoerNcRZtAOhgvRJ9YlZsxD6FUpx7JD5F3PJNBpAcHTzDxbDcX7cUMQRxzEvjRQ5Z XHVFwWoOKo1YtgDnybopuVTioKsU4aeCGUNfmq8VDwXBcEX7f4AvaoiQEcI907dKCGki nJYgl4FR1bnnO8y08SuEeVHrwawGcIZxBOrtMWmru4Nu3RYsmL35Jbx2EUtSIs82SqQs zA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kn3jtav6r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:49 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlnmX012600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:49 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79BlmRk020131; Thu, 9 Aug 2018 11:47:48 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:48 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:31 +0300 Message-Id: <1533815202-11967-19-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 18/29] vmsvga: Add support for SVGA_IRQFLAG_FIFO_PROGRESS 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP If vmsvga supports interrupts (SVGA_CAP_IRQMASK), some guests wait for FIFO to become not full by sleeping until FIFO_PROGRESS interrupt occurs. This is the most efficient thing to do when the FIFO fills up. To support these guests, add support for SVGA_IRQFLAG_FIFO_PROGRESS. See usage example by guest in VMware SVGA development kit SVGAFIFOFull(). Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 597051ec5c92..dc5f4681f0d3 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -731,6 +731,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) uint32_t cmd_start; bool cmd_ignored; bool irq_pending = false; + bool fifo_progress = false; len = vmsvga_fifo_length(s); while (len > 0 && --maxloop > 0) { @@ -930,6 +931,15 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) s->fifo[SVGA_FIFO_STOP] = cpu_to_le32(s->fifo_stop); break; } + + if (s->fifo_stop != cmd_start) + fifo_progress = true; + } + + if ((s->irq_mask & SVGA_IRQFLAG_FIFO_PROGRESS) && + fifo_progress) { + s->irq_status |= SVGA_IRQFLAG_FIFO_PROGRESS; + irq_pending = true; } s->syncing = 0; 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)); From patchwork Thu Aug 9 11:46:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561333 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 4B3FE157B for ; Thu, 9 Aug 2018 12:13:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37AD82AF31 for ; Thu, 9 Aug 2018 12:13:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C2A12AF43; Thu, 9 Aug 2018 12:13:39 +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 AFF2D2AF31 for ; Thu, 9 Aug 2018 12:13:38 +0000 (UTC) Received: from localhost ([::1]:50157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjov-0004Cz-Sp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:13:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQ7-0005LK-V4 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQ5-0007XL-C1 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:00 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37186) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQ5-0007X3-2d for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:57 -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 w79BiO5f178018; Thu, 9 Aug 2018 11:47:56 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=GwtIjzJMhao4vyGaj9oJMjftDi89NlwGqKrgdrOrSLs=; b=G1tHRA5/cfN/HTJ2DH3iPr3SDTn9fcHK/InLcLJXmJBscncdMOtNRWoDUy/met1QP0zU RD411v7WBSa1GBYETLc5VVtZshK58k9CNpyFbCR4n53yIX60YryV+36sbd8C2KH326z7 qpDZJfcrdzANIeYdVCcngjYcJBElRLw79F2G7iZOR0s+UUKQ9h/CmtiV5JgWjkyTkE+a pXalWG0BYYoB5a8BiJKjjsphWoAFaGvhWYApzwnmlXO1IuWfY3wTY2H3Av6Dvz3QEvcP eOhkCfk9Zgz8qWNM8z0xjny5DpDnCYNjOc2LYX6YaKlj9JS0Aikp8umATHuqcdeKgSaN kQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2kn43p2uxu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:55 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BlssR007443 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:55 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79Blshv031306; Thu, 9 Aug 2018 11:47:54 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:54 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:33 +0300 Message-Id: <1533815202-11967-21-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=876 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 20/29] vmsvga: Use standard names for params defining hardware cursor image 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 AND/XOR mask is a standard method for defining hardware cursor images. These are also the names suggested by VMware SVGA DevKit. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 73e373665bdb..d79b3400452b 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -619,8 +619,8 @@ struct vmsvga_cursor_definition_s { uint32_t bpp; int hot_x; int hot_y; - uint32_t mask[1024]; - uint32_t image[4096]; + uint32_t and_mask[1024]; + uint32_t xor_mask[4096]; }; #define SVGA_BITMAP_SIZE(w, h) ((((w) + 31) >> 5) * (h)) @@ -638,20 +638,20 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, qc->hot_y = c->hot_y; switch (c->bpp) { case 1: - cursor_set_mono(qc, 0xffffff, 0x000000, (void *)c->image, - 1, (void *)c->mask); + cursor_set_mono(qc, 0xffffff, 0x000000, (void *)c->xor_mask, + 1, (void *)c->and_mask); #ifdef DEBUG cursor_print_ascii_art(qc, "vmware/mono"); #endif break; case 32: /* fill alpha channel from mask, set color to zero */ - cursor_set_mono(qc, 0x000000, 0x000000, (void *)c->mask, - 1, (void *)c->mask); + cursor_set_mono(qc, 0x000000, 0x000000, (void *)c->and_mask, + 1, (void *)c->and_mask); /* add in rgb values */ pixels = c->width * c->height; for (i = 0; i < pixels; i++) { - qc->data[i] |= c->image[i] & 0xffffff; + qc->data[i] |= c->xor_mask[i] & 0xffffff; } #ifdef DEBUG cursor_print_ascii_art(qc, "vmware/32bit"); @@ -801,9 +801,9 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) if (cursor.width > 256 || cursor.height > 256 || cursor.bpp > 32 - || SVGA_BITMAP_SIZE(x, y) > ARRAY_SIZE(cursor.mask) + || SVGA_BITMAP_SIZE(x, y) > ARRAY_SIZE(cursor.and_mask) || SVGA_PIXMAP_SIZE(x, y, cursor.bpp) - > ARRAY_SIZE(cursor.image)) { + > ARRAY_SIZE(cursor.xor_mask)) { goto badcmd; } @@ -813,10 +813,10 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) } for (args = 0; args < SVGA_BITMAP_SIZE(x, y); args++) { - cursor.mask[args] = vmsvga_fifo_read_raw(s); + cursor.and_mask[args] = vmsvga_fifo_read_raw(s); } for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.bpp); args++) { - cursor.image[args] = vmsvga_fifo_read_raw(s); + cursor.xor_mask[args] = vmsvga_fifo_read_raw(s); } #ifdef HW_MOUSE_ACCEL vmsvga_cursor_define(s, &cursor); From patchwork Thu Aug 9 11:46:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561285 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 A660113B4 for ; Thu, 9 Aug 2018 11:55:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 880342AED6 for ; Thu, 9 Aug 2018 11:55:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C4792AEF9; Thu, 9 Aug 2018 11:55:49 +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 0F2992AEE1 for ; Thu, 9 Aug 2018 11:55:49 +0000 (UTC) Received: from localhost ([::1]:50063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjXg-0004Km-6Z for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:55:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQA-0005Ml-JS for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQ7-0007Xp-Vr for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:02 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQ7-0007Xb-Mh for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:47:59 -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 w79Bif4Q146062; Thu, 9 Aug 2018 11:47:58 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=+/sZfNN8DKBn9jzVBXJtaBDV/ijQrFEVpsPLQP2MO9o=; b=lnEItzQEVDcSZboPVQbzx0D5XMzegQ+rxfv+nzMTg7txKN22UFzR+uBL3SIOZSgJA7hC IJhhVlmmtYCA6GvBgV9pU/JUQg9xzXrIV+H15zfYHzBV3EzEP/M0GKXAwdhpXz3qDaod uE/Q1dSOdI+L7w5eZanlxqvS2HUpuxenTvj2mE7XFWkcgRv3TT+DPItKky7qeUxv7oDk nkaqERsvJ9VjU5rPsrVfdq1XO8XkgAhfEC+Y/mMbqRVzQmajLGDpmKBduFnVNKvjmWLN c5N2o61nchz3ZyDcwE4GqU8ntLcVAn0GGiTN3gaylnZqu/IfYNEaRr4m2coVEDBoOVFy JA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kn3jtav79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:47:58 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Blw3w012958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:47:58 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79BlvbW020163; Thu, 9 Aug 2018 11:47:57 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:57 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:34 +0300 Message-Id: <1533815202-11967-22-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=787 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 21/29] vmsvga: Use AND mask bpp parameter in SVGA_CMD_DEFINE_CURSOR 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 Prefer variable names of cursor structure from VMware SVGA DevKit. In addition, make sure to use the AND mask bpp parameter in SVGA_CMD_DEFINE_CURSOR. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index d79b3400452b..ef2c8bdbf5be 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -616,9 +616,10 @@ struct vmsvga_cursor_definition_s { uint32_t width; uint32_t height; int id; - uint32_t bpp; int hot_x; int hot_y; + uint32_t and_mask_bpp; // Value must be 1 or equal to BITS_PER_PIXEL + uint32_t xor_mask_bpp; // Value must be 1 or equal to BITS_PER_PIXEL uint32_t and_mask[1024]; uint32_t xor_mask[4096]; }; @@ -636,7 +637,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, qc = cursor_alloc(c->width, c->height); qc->hot_x = c->hot_x; qc->hot_y = c->hot_y; - switch (c->bpp) { + switch (c->xor_mask_bpp) { case 1: cursor_set_mono(qc, 0xffffff, 0x000000, (void *)c->xor_mask, 1, (void *)c->and_mask); @@ -659,7 +660,7 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, break; default: fprintf(stderr, "%s: unhandled bpp %d, using fallback cursor\n", - __func__, c->bpp); + __func__, c->xor_mask_bpp); cursor_put(qc); qc = cursor_builtin_left_ptr(); } @@ -794,15 +795,18 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) cursor.hot_y = vmsvga_fifo_read(s); cursor.width = x = vmsvga_fifo_read(s); cursor.height = y = vmsvga_fifo_read(s); - vmsvga_fifo_read(s); - cursor.bpp = vmsvga_fifo_read(s); + cursor.and_mask_bpp = vmsvga_fifo_read(s); + cursor.xor_mask_bpp = vmsvga_fifo_read(s); - args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp); + args = SVGA_PIXMAP_SIZE(x, y, cursor.and_mask_bpp) + + SVGA_PIXMAP_SIZE(x, y, cursor.xor_mask_bpp); if (cursor.width > 256 || cursor.height > 256 - || cursor.bpp > 32 - || SVGA_BITMAP_SIZE(x, y) > ARRAY_SIZE(cursor.and_mask) - || SVGA_PIXMAP_SIZE(x, y, cursor.bpp) + || cursor.and_mask_bpp > 32 + || cursor.xor_mask_bpp > 32 + || SVGA_PIXMAP_SIZE(x, y, cursor.and_mask_bpp) + > ARRAY_SIZE(cursor.and_mask) + || SVGA_PIXMAP_SIZE(x, y, cursor.xor_mask_bpp) > ARRAY_SIZE(cursor.xor_mask)) { goto badcmd; } @@ -812,10 +816,10 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) goto rewind; } - for (args = 0; args < SVGA_BITMAP_SIZE(x, y); args++) { + for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.and_mask_bpp); args++) { cursor.and_mask[args] = vmsvga_fifo_read_raw(s); } - for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.bpp); args++) { + for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.xor_mask_bpp); args++) { cursor.xor_mask[args] = vmsvga_fifo_read_raw(s); } #ifdef HW_MOUSE_ACCEL From patchwork Thu Aug 9 11:46:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561293 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 A85D9139A for ; Thu, 9 Aug 2018 11:58:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 966762AE13 for ; Thu, 9 Aug 2018 11:58:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A5BC2AE33; Thu, 9 Aug 2018 11:58:29 +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 168982AE13 for ; Thu, 9 Aug 2018 11:58:28 +0000 (UTC) Received: from localhost ([::1]:50075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjaG-0006fs-4l for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 07:58:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQD-0005Ns-QH for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQB-0007YU-6R for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:05 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQA-0007YF-RS for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:03 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BimOA163101; Thu, 9 Aug 2018 11:48:01 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=OU27IuIxguFHcywK7Fmh2bNQNWcTMDmZuiVe8a5TEBg=; b=M2zbXx7Xdx9vR+/5cpP3gaSTor34nFonUzE47yt4xVfD6t5I5L/lC8AX+HfhU4kfK6yx 44Mkxi9kdGvYRKYkVXvMrtvv/xY+ALVjSIKKczNgUByola7B62Hx0ORetnLv0aFRZ22b jDiEoCbEJSw7hakPuvoIwCBo0LJXq8SRKBRd8emHv+GefLPRvNJmaWIs5vQF5rszWlD0 1qYksT+HLsS2+0t/jXG/5k2PSSXiI6BPoTemoPiMRwKyQC0A0AO57CpONsxYI2/Pcb2S 7QhU9kvcyw1NRl3YBtenq87oZAswHompNgYDHTh2twoAgFh7ir9mD+OSH+Dau73H8AOE Lw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2kn1nday16-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:01 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bm1AM018143 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:01 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 w79Bm0AC000597; Thu, 9 Aug 2018 11:48:00 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:48:00 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:35 +0300 Message-Id: <1533815202-11967-23-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=584 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.79 Subject: [Qemu-devel] [PATCH 22/29] vmsvga: Increase size of cursor AND bitmask 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 Some guests are using 64x64 32bpp cursor pixel array, the old size of 1024 integers was not sufficient to store such large masks. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index ef2c8bdbf5be..46f03fe90ac0 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -620,7 +620,7 @@ struct vmsvga_cursor_definition_s { int hot_y; uint32_t and_mask_bpp; // Value must be 1 or equal to BITS_PER_PIXEL uint32_t xor_mask_bpp; // Value must be 1 or equal to BITS_PER_PIXEL - uint32_t and_mask[1024]; + uint32_t and_mask[4096]; uint32_t xor_mask[4096]; }; From patchwork Thu Aug 9 11:46:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561317 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 E348D157B for ; Thu, 9 Aug 2018 12:07:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFE492AF5C for ; Thu, 9 Aug 2018 12:07:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3C042AF64; Thu, 9 Aug 2018 12:07:44 +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 734312AF5C for ; Thu, 9 Aug 2018 12:07:43 +0000 (UTC) Received: from localhost ([::1]:50120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjjC-0006CW-6f for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:07:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQG-0005QR-H1 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQE-0007ZP-E3 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:08 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQE-0007Z3-2t for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:06 -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 w79Bif4R146062; Thu, 9 Aug 2018 11:48:05 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=JkbkawNodp12jYC7sFaOIE144B7IJr5XIyEOHv6KxkY=; b=bmkUyrB+NtROuV4vxT1Jcjy85jmtmaUhWkyvxkUCDVE0CXgkd2tSdImrt/nNlHZyJvGT T/DEmh2+oa/D2v5CmdXORLqrdIr23J9CzmKyFXRlTGUggKB3HSBta/9LQDQgFWq2veeE UB1Dd0O3aNw/rfEGarhP3NQUZP9gF7+zLhkMRZFt84dCPxVTjxXVwhhz2jhiKTanhJC/ SGZisUHEuv6wIrsf4bbQha5tdmwah79zpe0lMmA7ED7WMk8bnXbQzrslVEEp1VWxUY/F Wv3yOSzsBEROfgFBDuM8vjPZfDGWeryyr9wkwY5Qcp8d1JQ3HibLbRXzBSpn7P3p2PV3 oA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kn3jtav7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:04 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bm45p013443 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:04 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 w79Bm3xV001178; Thu, 9 Aug 2018 11:48:03 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:48:03 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:36 +0300 Message-Id: <1533815202-11967-24-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=980 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 23/29] vmsvga: Implement initial support for rgb-alpha cursors 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 This adds missing implementation of cursors having rgb and alpha-blending component. Although more work is required in QEMU framework to fully support alpha-blending functionality for cursors, the suggested fix shows well defined cursor shape instead of crashing video device or no hint of visible mouse cursor. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 85 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 46f03fe90ac0..49b46938207e 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -668,6 +668,38 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s, dpy_cursor_define(s->vga.con, qc); cursor_put(qc); } + +static inline void vmsvga_rgba_cursor_define(struct vmsvga_state_s *s, + struct vmsvga_cursor_definition_s *c) +{ + QEMUCursor *qc; + int i, pixels = c->width * c->height; + + qc = cursor_alloc(c->width, c->height); + qc->hot_x = c->hot_x; + qc->hot_y = c->hot_y; + + /* fill alpha channel and rgb values */ + for (i = 0; i < pixels; i++) { + qc->data[i] = c->xor_mask[i]; + /* + * Turn semi-transparent pixels to fully opaque + * (opaque pixels stay opaque), due to lack of + * alpha-blending support in QEMU framework. + * This is a trade-off between cursor completely + * missing and cursors with some minor artifacts + * (such as Windows Aero style cursors). + */ + if (c->and_mask[i]) { + qc->data[i] |= 0xff000000; + } + } +#ifdef DEBUG + cursor_print_ascii_art(qc, "rgba"); +#endif + dpy_cursor_define(s->vga.con, qc); + cursor_put(qc); +} #endif static inline int vmsvga_fifo_length(struct vmsvga_state_s *s) @@ -728,7 +760,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) { uint32_t cmd, colour; int args, len, maxloop = 1024; - int x, y, dx, dy, width, height; + int i, x, y, dx, dy, width, height; struct vmsvga_cursor_definition_s cursor; uint32_t cmd_start; uint32_t fence_arg; @@ -830,6 +862,44 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) goto badcmd; #endif + case SVGA_CMD_DEFINE_ALPHA_CURSOR: + len -= 6; + if (len < 0) { + goto rewind; + } + + cursor.id = vmsvga_fifo_read(s); + cursor.hot_x = vmsvga_fifo_read(s); + cursor.hot_y = vmsvga_fifo_read(s); + cursor.width = x = vmsvga_fifo_read(s); + cursor.height = y = vmsvga_fifo_read(s); + cursor.and_mask_bpp = 32; + cursor.xor_mask_bpp = 32; + args = x * y; + if ((SVGA_PIXMAP_SIZE(x, y, 32) > ARRAY_SIZE(cursor.and_mask)) + || (SVGA_PIXMAP_SIZE(x, y, 32) > ARRAY_SIZE(cursor.xor_mask))) { + goto badcmd; + } + + len -= args; + if (len < 0) { + goto rewind; + } + + for (i = 0; i < args; i++) { + uint32_t rgba = vmsvga_fifo_read_raw(s); + cursor.xor_mask[i] = rgba & 0x00ffffff; + cursor.and_mask[i] = rgba & 0xff000000; + } + +#ifdef HW_MOUSE_ACCEL + vmsvga_rgba_cursor_define(s, &cursor); + break; +#else + args = 0; + goto badcmd; +#endif + case SVGA_CMD_FRONT_ROP_FILL: len -= 1; if (len < 0) { @@ -903,18 +973,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) } args = 7; goto badcmd; - case SVGA_CMD_DEFINE_ALPHA_CURSOR: - len -= 6; - if (len < 0) { - goto rewind; - } - vmsvga_fifo_read(s); - vmsvga_fifo_read(s); - vmsvga_fifo_read(s); - x = vmsvga_fifo_read(s); - y = vmsvga_fifo_read(s); - args = x * y; - goto badcmd; case SVGA_CMD_DRAW_GLYPH_CLIPPED: /* deprecated */ len -= 4; if (len < 0) { @@ -1085,6 +1143,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) #endif #ifdef HW_MOUSE_ACCEL if (dpy_cursor_define_supported(s->vga.con)) { + caps |= SVGA_CAP_ALPHA_CURSOR; caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS; } From patchwork Thu Aug 9 11:46:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561323 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 7F893174A for ; Thu, 9 Aug 2018 12:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD982A450 for ; Thu, 9 Aug 2018 12:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 609AD2AF42; Thu, 9 Aug 2018 12:10:27 +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 5050D2A450 for ; Thu, 9 Aug 2018 12:10:26 +0000 (UTC) Received: from localhost ([::1]:50143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjlp-0001U6-Ff for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:10:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQM-0005Vy-3d for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQJ-0007e3-FC for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:14 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:32970) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQJ-0007dh-5W for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:11 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiRH0138024; Thu, 9 Aug 2018 11:48:10 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=qcLVbp+gOUxm8naz0Tnp6owRBdyIAarYZPcye5GMqiE=; b=BE6Mmx4T5JwemNuYWkVrx3Xp5XUezT2QTkXhckX/pmuspy5opHrmAWvvYw7Vtc4EXeDb m/vjelV6PEiQYNa8NLbr1kGTFOaCMrt11lXGYyAFvwRRdS4oRcyds/e0I+tDJSvoFGed CxgC4/sZYDBxh+FE/H3eldvNEa1YjPkXSFiEb7s9AIc1eIkp9CwsOk7TgP6upqRj7Kgy wjHmThU6ovl2t2t4+9f5MAlj4XWZ6470/vnL0mpsNHsRfCJFMlqwjjkYRKSD2EWIT7F3 aYO2eY0Nf9uCt0SORHH2NIJu+i0r8ZCs840APICwQE/Vdr87XTKAlzls4eskTig6pQkP 6w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2kn4sq2s9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:10 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bm7a2018736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:07 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79Bm6Ax020214; Thu, 9 Aug 2018 11:48:06 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:48:06 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:37 +0300 Message-Id: <1533815202-11967-25-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.85 Subject: [Qemu-devel] [PATCH 24/29] vmsvga: Add support for SVGA_FIFO_CAP_CURSOR_BYPASS_3 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 This adds tracking of guest cursor position with the help of FIFO registers reporting pointing device coordindates. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 49b46938207e..1db8f92f053b 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -51,6 +51,7 @@ struct vmsvga_state_s { int y; int on; } cursor; + uint32_t last_fifo_cursor_count; int index; int scratch_size; @@ -326,6 +327,7 @@ enum { #define SVGA_FIFO_CAP_FENCE (1 << 0) #define SVGA_FIFO_CAP_ACCELFRONT (1 << 1) #define SVGA_FIFO_CAP_PITCHLOCK (1 << 2) +#define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1 << 4) #define SVGA_FIFO_FLAG_NONE 0 #define SVGA_FIFO_FLAG_ACCELFRONT (1 << 0) @@ -417,6 +419,35 @@ enum { SVGA_CURSOR_ON_RESTORE_TO_FB = 3, }; +/* Update cursor position from SVGA_FIFO_CURSOR registers */ +static void cursor_update_from_fifo(struct vmsvga_state_s *s) +{ + uint32_t fifo_cursor_count; + uint32_t on_off; + + if (!s->config || !s->enable) { + return; + } + + if (s->fifo_min <= SVGA_FIFO_CURSOR_LAST_UPDATED) { + return; + } + + fifo_cursor_count = s->fifo[SVGA_FIFO_CURSOR_COUNT]; + if (fifo_cursor_count == s->last_fifo_cursor_count) + return; + + s->last_fifo_cursor_count = fifo_cursor_count; + on_off = s->fifo[SVGA_FIFO_CURSOR_ON] ? SVGA_CURSOR_ON_SHOW : SVGA_CURSOR_ON_HIDE; + s->cursor.on = on_off; + s->cursor.x = s->fifo[SVGA_FIFO_CURSOR_X]; + s->cursor.y = s->fifo[SVGA_FIFO_CURSOR_Y]; + +#ifdef HW_MOUSE_ACCEL + dpy_mouse_set(s->vga.con, s->cursor.x, s->cursor.y, s->cursor.on); +#endif +} + static inline bool vmsvga_verify_rect(DisplaySurface *surface, const char *name, int x, int y, int w, int h) @@ -1423,6 +1454,7 @@ static void vmsvga_update_display(void *opaque) vmsvga_fifo_run(s); vmsvga_update_rect_flush(s); + cursor_update_from_fifo(s); if (s->invalidated) { s->invalidated = 0; @@ -1446,6 +1478,7 @@ static void vmsvga_reset(DeviceState *dev) s->syncing = 0; s->irq_mask = 0; s->irq_status = 0; + s->last_fifo_cursor_count = 0; vga_dirty_log_start(&s->vga); } @@ -1479,6 +1512,7 @@ static int vmsvga_post_load(void *opaque, int version_id) if (version_id < 1) { s->irq_mask = 0; s->irq_status = 0; + s->last_fifo_cursor_count = 0; } return 0; @@ -1508,6 +1542,7 @@ static const VMStateDescription vmstate_vmware_vga_internal = { VMSTATE_UNUSED(4), /* was fb_size */ VMSTATE_UINT32_V(irq_mask, struct vmsvga_state_s, 1), VMSTATE_UINT32_V(irq_status, struct vmsvga_state_s, 1), + VMSTATE_UINT32_V(last_fifo_cursor_count, struct vmsvga_state_s, 1), VMSTATE_END_OF_LIST() } }; @@ -1543,7 +1578,8 @@ 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] = SVGA_FIFO_CAP_FENCE; + s->fifo[SVGA_FIFO_CAPABILITIES] = + SVGA_FIFO_CAP_FENCE | SVGA_FIFO_CAP_CURSOR_BYPASS_3; s->fifo[SVGA_FIFO_FLAGS] = 0; vga_common_init(&s->vga, OBJECT(dev)); From patchwork Thu Aug 9 11:46:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561331 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 4393D157B for ; Thu, 9 Aug 2018 12:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31CEE21E5A for ; Thu, 9 Aug 2018 12:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 265AC2580E; Thu, 9 Aug 2018 12:13:15 +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 6223A22A65 for ; Thu, 9 Aug 2018 12:13:14 +0000 (UTC) Received: from localhost ([::1]:50150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjoS-0002i3-I3 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:13:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQM-0005WQ-ID for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQJ-0007eC-US for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:14 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQJ-0007dq-L6 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:11 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79Biv9l163162; Thu, 9 Aug 2018 11:48:10 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=EIXa/1M66APKSIH1eo+CKnk6DpKuZxE7qHNb4sdoNbA=; b=AL41zACKnGDB3Zj2d6I5YrWQ6Hc1AFdvJylhRMHUxEfJHFGocU0DbKKfLJDmi0uWkdV2 2X7xjj5Xa9BTV5X+4E+FTxkwQ27nPh8pLL77HezY1Xy6gidcCTvRM6KwBIlTx3uaRlUO EQMcAoFB6BU91l7hNEyMf4qHYslHQwp6EDZxjVmugfmYCAyxSzegrC/Dd1Zwz7cQtbDr ZVgsFLuzHtn8n/0zXO0zQIKCUEFZddaAIh9u8SnRxlraHG4nixhEWRWrGdU7el0nFrb4 qiadJ2urhnbZK5W7FEUEL8WIAe28PdaDTrpRmHvYKiHlsNbYUtkZg5w6fZ6iiXBJEtdt +w== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2kn1nday1m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:10 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bm9gp022548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:10 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 w79Bm95l001195; Thu, 9 Aug 2018 11:48:09 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:48:08 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:38 +0300 Message-Id: <1533815202-11967-26-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=953 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.79 Subject: [Qemu-devel] [PATCH 25/29] vmsvga: Add basic support for GMR registers and FIFO commands 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We don't support GMR regions while reporting caps, but some guests may try to send us some GMR queries and we do our best to ignore them while avoiding FIFO command crash. Reported-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 1db8f92f053b..b2f3456357bd 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -164,6 +164,12 @@ enum { SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ SVGA_REG_IRQMASK = 33, /* Interrupt mask */ + /* Guest memory regions */ + SVGA_REG_GMR_ID = 41, + SVGA_REG_GMR_DESCRIPTOR = 42, + SVGA_REG_GMR_MAX_IDS = 43, + SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44, + SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ SVGA_PALETTE_END = SVGA_PALETTE_BASE + 767, SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + 768, @@ -409,6 +415,8 @@ enum { SVGA_CMD_SURFACE_ALPHA_BLEND = 28, /* deprecated */ SVGA_CMD_FRONT_ROP_FILL = 29, SVGA_CMD_FENCE = 30, + SVGA_CMD_DEFINE_GMR2 = 41, + SVGA_CMD_REMAP_GMR2 = 42, }; /* Legal values for the SVGA_REG_CURSOR_ON register in cursor bypass mode */ @@ -419,6 +427,13 @@ enum { SVGA_CURSOR_ON_RESTORE_TO_FB = 3, }; +enum { + SVGA_REMAP_GMR2_PPN32 = 0, + SVGA_REMAP_GMR2_VIA_GMR = (1 << 0), + SVGA_REMAP_GMR2_PPN64 = (1 << 1), + SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2), +}; + /* Update cursor position from SVGA_FIFO_CURSOR registers */ static void cursor_update_from_fifo(struct vmsvga_state_s *s) { @@ -795,6 +810,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) struct vmsvga_cursor_definition_s cursor; uint32_t cmd_start; uint32_t fence_arg; + uint32_t flags, num_pages; bool cmd_ignored; bool irq_pending = false; bool fifo_progress = false; @@ -961,6 +977,36 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) break; + case SVGA_CMD_DEFINE_GMR2: + len -= 1; + if (len < 0) { + goto rewind; + } + args = 2; + goto badcmd; + + case SVGA_CMD_REMAP_GMR2: + len -= 5; + if (len < 0) { + goto rewind; + } + + vmsvga_fifo_read(s); /* gmrId */ + flags = vmsvga_fifo_read(s); + vmsvga_fifo_read(s); /* offsetPages */ + num_pages = vmsvga_fifo_read(s); + + if (flags & SVGA_REMAP_GMR2_VIA_GMR) { + /* Read single struct SVGAGuestPtr */ + args = 2; + } else { + args = (flags & SVGA_REMAP_GMR2_SINGLE_PPN) ? 1 : num_pages; + if (flags & SVGA_REMAP_GMR2_PPN64) + args *= 2; + } + + goto badcmd; + /* * Deprecated commands are neither documented in VMware SVGA development kit * nor in Linux kernel vmware-svga driver source code. @@ -1242,6 +1288,15 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) ret = s->irq_mask; break; + /* Guest memory regions */ + case SVGA_REG_GMR_ID: + case SVGA_REG_GMR_DESCRIPTOR: + case SVGA_REG_GMR_MAX_IDS: + case SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH: + /* We don't support GMRs */ + ret = 0; + break; + default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) { From patchwork Thu Aug 9 11:46:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561341 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 4EF27157B for ; Thu, 9 Aug 2018 12:16:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BDB32AF5B for ; Thu, 9 Aug 2018 12:16:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FD082AF71; Thu, 9 Aug 2018 12:16:38 +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 97B172AF5B for ; Thu, 9 Aug 2018 12:16:37 +0000 (UTC) Received: from localhost ([::1]:50176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjro-0006pT-Ll for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:16:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQP-0005ZB-21 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQM-0007em-El for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:17 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQM-0007eT-4j for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:14 -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 w79BiaMM146030; Thu, 9 Aug 2018 11:48:13 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=UteMmBsZlXg1GDFUAugPFnN4RjbpNcq4B2w95Ss/k0Y=; b=knqcPvVEXI7pA2bcUXymIV27beJriUV7QrhJ2+a79HH4/G/1Foe6okZc48F64b6bhPIf MaQgjb9WzxPpd8jylNrJSHgTST6YSbRcRKn2Rf4auIn+bfR3PQ7RR1EP8jybky77GVFP RzSegH+/G6HNiZdpM6Op29R34AUDnFxAF4TM+Mf2A2ETM1Qj6bqbM/GwNH4pEDiSnIkU Yx22BMZvkrVOqRgH1ZSFjX9R9RmSJVIftDdrOBkLZoXIbtLk+99BpEJgQBCHkOu5TFSg cr95Lm48GlGI01knbSpBugrJmEQiWwvUq310ognvya4Q3BMxm7QShrR6EtXB+e3EnLht pQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2kn3jtav7w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:13 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmCQw008166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:12 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmCmc031481; Thu, 9 Aug 2018 11:48:12 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:48:11 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:39 +0300 Message-Id: <1533815202-11967-27-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 26/29] vmsvga: Add basic support for display topology 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 Report SVGA_CAP_DISPLAY_TOPOLOGY capability and support single legacy screen at fixed offset of (0,0). This is a pre-requesite for supporting PITCHLOCK feature which is required by Linux kernel vmsvga driver (See Linux kernel vmw_driver_load()). Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index b2f3456357bd..edd336e65005 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -81,6 +81,7 @@ struct vmsvga_state_s { uint32_t num_fifo_regs; uint32_t irq_mask; uint32_t irq_status; + uint32_t display_id; }; #define TYPE_VMWARE_SVGA "vmware-svga" @@ -103,6 +104,9 @@ struct pci_vmsvga_state_s { #define SVGA_ID_1 SVGA_MAKE_ID(1) #define SVGA_ID_2 SVGA_MAKE_ID(2) +/* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */ +#define SVGA_ID_INVALID 0xFFFFFFFF + #define SVGA_LEGACY_BASE_PORT 0x4560 #define SVGA_INDEX_PORT 0x0 #define SVGA_VALUE_PORT 0x1 @@ -164,6 +168,15 @@ enum { SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ SVGA_REG_IRQMASK = 33, /* Interrupt mask */ + /* Legacy multi-monitor support */ + SVGA_REG_NUM_GUEST_DISPLAYS = 34, /* Number of guest displays in X/Y direction */ + SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */ + SVGA_REG_DISPLAY_IS_PRIMARY = 36, /* Whether this is a primary display */ + SVGA_REG_DISPLAY_POSITION_X = 37, /* The display position x */ + SVGA_REG_DISPLAY_POSITION_Y = 38, /* The display position y */ + SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */ + SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */ + /* Guest memory regions */ SVGA_REG_GMR_ID = 41, SVGA_REG_GMR_DESCRIPTOR = 42, @@ -195,6 +208,7 @@ enum { #define SVGA_CAP_MULTIMON (1 << 16) #define SVGA_CAP_PITCHLOCK (1 << 17) #define SVGA_CAP_IRQMASK (1 << 18) +#define SVGA_CAP_DISPLAY_TOPOLOGY (1 << 19) // Legacy multi-monitor support /* * FIFO offsets (seen as an array of 32-bit words) @@ -1227,6 +1241,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) #endif caps |= SVGA_CAP_EXTENDED_FIFO; caps |= SVGA_CAP_IRQMASK; + caps |= SVGA_CAP_DISPLAY_TOPOLOGY; ret = caps; break; @@ -1288,6 +1303,32 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) ret = s->irq_mask; break; + case SVGA_REG_NUM_GUEST_DISPLAYS: + ret = 1; + break; + case SVGA_REG_DISPLAY_ID: + ret = s->display_id; + break; + case SVGA_REG_DISPLAY_IS_PRIMARY: + ret = s->display_id == 0 ? 1 : 0; + break; + case SVGA_REG_DISPLAY_POSITION_X: + case SVGA_REG_DISPLAY_POSITION_Y: + ret = 0; + break; + case SVGA_REG_DISPLAY_WIDTH: + if ((s->display_id == 0) || (s->display_id == SVGA_ID_INVALID)) + ret = s->new_width ? s->new_width : surface_width(surface); + else + ret = 0; + break; + case SVGA_REG_DISPLAY_HEIGHT: + if ((s->display_id == 0) || (s->display_id == SVGA_ID_INVALID)) + ret = s->new_height ? s->new_height : surface_height(surface); + else + ret = 0; + break; + /* Guest memory regions */ case SVGA_REG_GMR_ID: case SVGA_REG_GMR_DESCRIPTOR: @@ -1431,6 +1472,28 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) s->irq_mask = value; break; + /* We support single legacy screen at fixed offset of (0,0) */ + case SVGA_REG_DISPLAY_ID: + s->display_id = value; + break; + case SVGA_REG_NUM_GUEST_DISPLAYS: + case SVGA_REG_DISPLAY_IS_PRIMARY: + case SVGA_REG_DISPLAY_POSITION_X: + case SVGA_REG_DISPLAY_POSITION_Y: + break; + case SVGA_REG_DISPLAY_WIDTH: + if ((s->display_id == 0) && (value <= SVGA_MAX_WIDTH)) { + s->new_width = value; + s->invalidated = 1; + } + break; + case SVGA_REG_DISPLAY_HEIGHT: + if ((s->display_id == 0) && (value <= SVGA_MAX_HEIGHT)) { + s->new_height = value; + s->invalidated = 1; + } + break; + default: if (s->index >= SVGA_SCRATCH_BASE && s->index < SVGA_SCRATCH_BASE + s->scratch_size) { @@ -1534,6 +1597,7 @@ static void vmsvga_reset(DeviceState *dev) s->irq_mask = 0; s->irq_status = 0; s->last_fifo_cursor_count = 0; + s->display_id = SVGA_ID_INVALID; vga_dirty_log_start(&s->vga); } @@ -1568,6 +1632,7 @@ static int vmsvga_post_load(void *opaque, int version_id) s->irq_mask = 0; s->irq_status = 0; s->last_fifo_cursor_count = 0; + s->display_id = SVGA_ID_INVALID; } return 0; @@ -1598,6 +1663,7 @@ static const VMStateDescription vmstate_vmware_vga_internal = { VMSTATE_UINT32_V(irq_mask, struct vmsvga_state_s, 1), VMSTATE_UINT32_V(irq_status, struct vmsvga_state_s, 1), VMSTATE_UINT32_V(last_fifo_cursor_count, struct vmsvga_state_s, 1), + VMSTATE_UINT32_V(display_id, struct vmsvga_state_s, 1), VMSTATE_END_OF_LIST() } }; From patchwork Thu Aug 9 11:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561301 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 99B6614E2 for ; Thu, 9 Aug 2018 12:01:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C352AFAC for ; Thu, 9 Aug 2018 12:01:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C0832AF76; Thu, 9 Aug 2018 12:01:16 +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 DCDAD2AFAB for ; Thu, 9 Aug 2018 12:01:15 +0000 (UTC) Received: from localhost ([::1]:50094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjcu-0001Ub-Cv for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:01:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQR-0005ba-Lv for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQP-0007fT-1s for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:19 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37398) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQO-0007fC-NJ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:16 -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 w79BiCmK177696; Thu, 9 Aug 2018 11:48:15 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=RyZnJu2Pi/urius5ZemuucRlNHtpZqC48VVS/Nt1PtM=; b=u0a3v68KEfURXRN3n9DTBztVvQqTGjUCCCd9OTymw0haxTr/UzpBw+BCDpk8fDCrGDgU avsEZJ6Pxu/cjwBdJcagZiCWUuJuj4UP7m7sncYWWLj5FOdB1Cp2we24uRR58GJCtgRH IErojfw07C91/uiprw3j4huBMYs2VMEcHrwlCWdswJfBu/ihLDJYMwt7vQEjNFku2EAF oGkPkuNcyfCjtbpCAkrw/pVPdsDvrx+Y+0tCbejirM9HuvqEQ7v4+mmICr6CD0VsxF+r fPIBL7rJ2hCnImdFbCffbTUCXpI71Hy2PridF6fWraWMYidUEfzDpsMpiLXegIliNOOO 9Q== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2kn43p2uyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:15 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmFpM022696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:15 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmFZL031503; Thu, 9 Aug 2018 11:48:15 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:48:14 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:40 +0300 Message-Id: <1533815202-11967-28-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 27/29] vmsvga: Add support for pitchlock register (a display line stride) 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 Indicate support of SVGA_REG_PITCHLOCK in device capabilities. Value written by driver to SVGA_REG_PITCHLOCK is used to overwrite the default line length derived from display width and bpp. Due to lack of clear documentation, we resume using default formula for line length when screen width is updated more than once without update to SVGA_REG_PITCHLOCK register, which works for all tested guests using vmsvga. SVGA_REG_PITCHLOCK is required by Linux kernel vmsvga driver (See Linux kernel vmw_driver_load()). Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index edd336e65005..bd7202833081 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -82,6 +82,8 @@ struct vmsvga_state_s { uint32_t irq_mask; uint32_t irq_status; uint32_t display_id; + uint32_t pitchlock; + int use_pitchlock; }; #define TYPE_VMWARE_SVGA "vmware-svga" @@ -1198,9 +1200,10 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) break; case SVGA_REG_BYTES_PER_LINE: - if (s->new_width) { - ret = (s->new_depth * s->new_width) / 8; - } else { + ret = (s->use_pitchlock >= 0) ? + s->pitchlock : + ((s->new_depth * s->new_width) / 8); + if (!ret) { ret = surface_stride(surface); } break; @@ -1242,6 +1245,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) caps |= SVGA_CAP_EXTENDED_FIFO; caps |= SVGA_CAP_IRQMASK; caps |= SVGA_CAP_DISPLAY_TOPOLOGY; + caps |= SVGA_CAP_PITCHLOCK; ret = caps; break; @@ -1294,11 +1298,14 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) break; case SVGA_REG_NUM_DISPLAYS: - case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: ret = 0; break; + case SVGA_REG_PITCHLOCK: + ret = s->pitchlock; + break; + case SVGA_REG_IRQMASK: ret = s->irq_mask; break; @@ -1394,6 +1401,13 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) if (value <= SVGA_MAX_WIDTH) { s->new_width = value; s->invalidated = 1; + /* This is a hack used to drop effective pitchlock setting + * when guest writes screen width without prior write to + * the pitchlock register. + */ + if (s->use_pitchlock >= 0) { + s->use_pitchlock--; + } } else { printf("%s: Bad width: %i\n", __func__, value); } @@ -1464,10 +1478,15 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) case SVGA_REG_DEPTH: case SVGA_REG_MEM_REGS: case SVGA_REG_NUM_DISPLAYS: - case SVGA_REG_PITCHLOCK: case SVGA_PALETTE_BASE ... SVGA_PALETTE_END: break; + case SVGA_REG_PITCHLOCK: + s->pitchlock = value; + s->use_pitchlock = (value > 0) ? 1 : -1; + s->invalidated = 1; + break; + case SVGA_REG_IRQMASK: s->irq_mask = value; break; @@ -1540,16 +1559,20 @@ static void vmsvga_bios_write(void *opaque, uint32_t address, uint32_t data) static inline void vmsvga_check_size(struct vmsvga_state_s *s) { DisplaySurface *surface = qemu_console_surface(s->vga.con); + uint32_t new_stride; + new_stride = (s->use_pitchlock >= 0) ? + s->pitchlock : + ((s->new_depth * s->new_width) / 8); if (s->new_width != surface_width(surface) || s->new_height != surface_height(surface) || + (new_stride != surface_stride(surface)) || s->new_depth != surface_bits_per_pixel(surface)) { - int stride = (s->new_depth * s->new_width) / 8; pixman_format_code_t format = qemu_default_pixman_format(s->new_depth, true); trace_vmware_setmode(s->new_width, s->new_height, s->new_depth); surface = qemu_create_displaysurface_from(s->new_width, s->new_height, - format, stride, + format, new_stride, s->vga.vram_ptr); dpy_gfx_replace_surface(s->vga.con, surface); s->invalidated = 1; @@ -1598,6 +1621,8 @@ static void vmsvga_reset(DeviceState *dev) s->irq_status = 0; s->last_fifo_cursor_count = 0; s->display_id = SVGA_ID_INVALID; + s->pitchlock = 0; + s->use_pitchlock = -1; vga_dirty_log_start(&s->vga); } @@ -1633,6 +1658,8 @@ static int vmsvga_post_load(void *opaque, int version_id) s->irq_status = 0; s->last_fifo_cursor_count = 0; s->display_id = SVGA_ID_INVALID; + s->pitchlock = 0; + s->use_pitchlock = -1; } return 0; @@ -1664,6 +1691,8 @@ static const VMStateDescription vmstate_vmware_vga_internal = { VMSTATE_UINT32_V(irq_status, struct vmsvga_state_s, 1), VMSTATE_UINT32_V(last_fifo_cursor_count, struct vmsvga_state_s, 1), VMSTATE_UINT32_V(display_id, struct vmsvga_state_s, 1), + VMSTATE_UINT32_V(pitchlock, struct vmsvga_state_s, 1), + VMSTATE_INT32_V(use_pitchlock, struct vmsvga_state_s, 1), VMSTATE_END_OF_LIST() } }; From patchwork Thu Aug 9 11:46:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561335 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 DE298157B for ; Thu, 9 Aug 2018 12:13:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1FD2AF4D for ; Thu, 9 Aug 2018 12:13:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0BAC2AF5B; Thu, 9 Aug 2018 12:13:52 +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 61D7A2AF4D for ; Thu, 9 Aug 2018 12:13:52 +0000 (UTC) Received: from localhost ([::1]:50158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjp9-0004P1-Gb for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:13:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQU-0005cN-In for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQR-0007hj-R2 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:22 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQR-0007gx-Fu for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:19 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BidFD163073; Thu, 9 Aug 2018 11:48: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=EK2eI5yW5+h/5DyN67K6qxZ4l4NPErFn5tTJimqGS4E=; b=kVk+N0sg2GBNmTkQmkJsjFS3tYXBWmFzA1W/zluyfLBdAbTLWAOjlIQ5Cz8ZuUEOafXS N3fv7YANeOD6NCymDteOOi300HDP7SVnm1yL8xhk/o/RbdKwMlzxcIiTxQ34wUFMqkVV Os5PH5LWXDGA22lHXAzrFOf8fIh1gvK+uNb5MMVIbYVTYINkcBRQ0NWV7+AGva7w7tpC yczrfgS+D2jrEexh/Er/m8003tMH5x8hwRTin87mIvedDu7SiPnirBNvPPtuinh6/UUe DJImQf8iOkWlelS9XVnm+kKY5OM50VP7JuUj9EaC0Z7LQ3QoH7Qs1vq8olKa3c5BLeOY fQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2kn1nday1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:18 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmIRD019436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:18 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmIh2031513; Thu, 9 Aug 2018 11:48:18 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:48:17 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:41 +0300 Message-Id: <1533815202-11967-29-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.79 Subject: [Qemu-devel] [PATCH 28/29] vmsvga: Introduce new function for reporting device capabilities 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 This in only code refactoring without change in semantics. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index bd7202833081..389248b4badf 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -479,6 +479,30 @@ static void cursor_update_from_fifo(struct vmsvga_state_s *s) #endif } +/* Report device capabilities */ +static uint32_t vmsvga_device_caps(struct vmsvga_state_s *s) +{ + uint32_t caps = SVGA_CAP_NONE; +#ifdef HW_RECT_ACCEL + caps |= SVGA_CAP_RECT_COPY; +#endif +#ifdef HW_FILL_ACCEL + caps |= SVGA_CAP_RECT_FILL; +#endif +#ifdef HW_MOUSE_ACCEL + if (dpy_cursor_define_supported(s->vga.con)) { + caps |= SVGA_CAP_ALPHA_CURSOR; + caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | + SVGA_CAP_CURSOR_BYPASS; + } +#endif + caps |= SVGA_CAP_IRQMASK; + caps |= SVGA_CAP_EXTENDED_FIFO; + caps |= SVGA_CAP_DISPLAY_TOPOLOGY; + caps |= SVGA_CAP_PITCHLOCK; + return caps; +} + static inline bool vmsvga_verify_rect(DisplaySurface *surface, const char *name, int x, int y, int w, int h) @@ -1140,7 +1164,6 @@ static void vmsvga_index_write(void *opaque, uint32_t address, uint32_t index) static uint32_t vmsvga_value_read(void *opaque, uint32_t address) { - uint32_t caps; struct vmsvga_state_s *s = opaque; DisplaySurface *surface = qemu_console_surface(s->vga.con); PixelFormat pf; @@ -1228,25 +1251,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) break; case SVGA_REG_CAPABILITIES: - caps = SVGA_CAP_NONE; -#ifdef HW_RECT_ACCEL - caps |= SVGA_CAP_RECT_COPY; -#endif -#ifdef HW_FILL_ACCEL - caps |= SVGA_CAP_RECT_FILL; -#endif -#ifdef HW_MOUSE_ACCEL - if (dpy_cursor_define_supported(s->vga.con)) { - caps |= SVGA_CAP_ALPHA_CURSOR; - caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | - SVGA_CAP_CURSOR_BYPASS; - } -#endif - caps |= SVGA_CAP_EXTENDED_FIFO; - caps |= SVGA_CAP_IRQMASK; - caps |= SVGA_CAP_DISPLAY_TOPOLOGY; - caps |= SVGA_CAP_PITCHLOCK; - ret = caps; + ret = vmsvga_device_caps(s); break; case SVGA_REG_MEM_START: { From patchwork Thu Aug 9 11:46:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561309 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 D99F514E2 for ; Thu, 9 Aug 2018 12:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C68E02AF52 for ; Thu, 9 Aug 2018 12:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA0B62AF5C; Thu, 9 Aug 2018 12:04:27 +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 B54AA2AF52 for ; Thu, 9 Aug 2018 12:04:26 +0000 (UTC) Received: from localhost ([::1]:50102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjg1-0002i0-VC for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:04:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQY-0005g9-Cr for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQV-0007ir-Qc for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:26 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48720) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQV-0007iU-Fx for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:23 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiHil162731; Thu, 9 Aug 2018 11:48:22 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=jcZZj7jw4brC12dShNzWnByMBttGkI0MMqAh6QOXw5o=; b=VDyOmx1scG9/joxvm1ZN8hVt+ZC/cGGUIla7DU6shtPOVx/KmTp8365n1qG+3TEn36yY BJ1YUGbh80lqJgx5fnkVT7u0B2l7SJhYse7nCpd9WihVF9NMifuiEOO5Cy2tPT+R7JAc 0tk9V0DFitb1dFOce9t75ZYYH2Kym9dUhK3ekO0taFPsfaSICmkyy7yD0xq6XP0RMCHL 5kWbU8nNSjix2IIeOafj+0IxJ97q9JGw1h1tb1XSyX7BSfAFMUalEWiHV8LEtPtwXS1Z WNkLh+fi5RAgrF+EeV7C4SwqzLtph45QaYaXCUMtqDY7KwXT7uVfKK3VQnF5OVKLmSAT Iw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2kn1nday2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:22 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmLZe008531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:21 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79BmLBn031526; Thu, 9 Aug 2018 11:48:21 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:48:20 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:42 +0300 Message-Id: <1533815202-11967-30-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=704 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.79 Subject: [Qemu-devel] [PATCH 29/29] vmsvga: Don't allow setting screen size with zero width or height 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 Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 389248b4badf..1803a565fa07 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1566,6 +1566,9 @@ static inline void vmsvga_check_size(struct vmsvga_state_s *s) DisplaySurface *surface = qemu_console_surface(s->vga.con); uint32_t new_stride; + /* Don't allow setting uninitialized 0-size screen */ + if ((s->new_width == 0) || (s->new_height == 0)) return; + new_stride = (s->use_pitchlock >= 0) ? s->pitchlock : ((s->new_depth * s->new_width) / 8);