From nobody Sat May 18 10:48:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588161337; cv=none; d=zohomail.com; s=zohoarc; b=hwTRL6r6hpN5eICNeIL3XQ6D+Nt9PUXNG5Dju/y2g/u5m04lOcBz8rcc5YgPXOuzRbbA/5toR24uL5dK0AmTJ5MICEtA+uKGH3ks5XEOGcq2/YaebxSQCJlmBuUst1x4YBz/KpKrf+yWTmXYMX+RmToPytaF/HPRigjVT+4U3ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588161337; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=tm4KGk38wO43KOIoFiLxdfsYfOnlvOe9wZpZmGa/WT0=; b=fEib0C3/L/gQyJfhn8AH62XOzXPSK4JJTcRuL+Unai9Me94mIFWNUCVudjz08RBo2s0KH3MY+MzHN4zDHUrZdydtJeAJx9AYc8OVgtGmyOQj3yZICOc3IMgT9xmJj+WhXw/oUfX148dKaqL4SOqW+kI1glN0nssZVmqF/AksxPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588161337235255.83776853636527; Wed, 29 Apr 2020 04:55:37 -0700 (PDT) Received: from localhost ([::1]:53186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlJQ-0002M7-10 for importer@patchew.org; Wed, 29 Apr 2020 07:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50896) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlGj-0005sb-H2 for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTlGi-0001zW-0I for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:49 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:30012 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTlGh-0001yi-Gy for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-6NQsq43lM5S8eqKh21zhuQ-1; Wed, 29 Apr 2020 07:52:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C23E61800D4A; Wed, 29 Apr 2020 11:52:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-193.ams2.redhat.com [10.36.113.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF6BE5D76A; Wed, 29 Apr 2020 11:52:37 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F38959D99; Wed, 29 Apr 2020 13:52:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588161166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tm4KGk38wO43KOIoFiLxdfsYfOnlvOe9wZpZmGa/WT0=; b=DrHnvIgWM0q3r8OznyGEsv/nDi25BBsDPrlUH5npAtdrvJxkk/ny5rTB4TYbstkgWwxh9y TEpnseT/MksEM5kA9Hngf4/ulAly08n6vXWVbQwBObEznqwD4Jzvwk8KfEoAWzTjgm4Lzc 46NXLzEGQqCYyfI3+JS1HKXlmBoposY= X-MC-Unique: 6NQsq43lM5S8eqKh21zhuQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] Revert "hw/display/ramfb: initialize fw-config space with xres/ yres" Date: Wed, 29 Apr 2020 13:52:31 +0200 Message-Id: <20200429115236.28709-2-kraxel@redhat.com> In-Reply-To: <20200429115236.28709-1-kraxel@redhat.com> References: <20200429115236.28709-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 01:28:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alex Williamson , lersek@redhat.com, Gerd Hoffmann , hqm03ster@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit f79081b4b71b72640bedd40a7cd76f864c8287f1. Patch has broken byteorder handling: RAMFBCfg fields are in bigendian byteorder, the reset function doesn't care so native byteorder is used instead. Given this went unnoticed so far the feature is obviously unused, so just revert the patch. Cc: Hou Qiming Signed-off-by: Gerd Hoffmann Acked-by: Laszlo Ersek --- include/hw/display/ramfb.h | 2 +- hw/display/ramfb-standalone.c | 12 +----------- hw/display/ramfb.c | 16 +--------------- hw/vfio/display.c | 4 ++-- stubs/ramfb.c | 2 +- 5 files changed, 6 insertions(+), 30 deletions(-) diff --git a/include/hw/display/ramfb.h b/include/hw/display/ramfb.h index f6c2de93b222..b33a2c467b28 100644 --- a/include/hw/display/ramfb.h +++ b/include/hw/display/ramfb.h @@ -4,7 +4,7 @@ /* ramfb.c */ typedef struct RAMFBState RAMFBState; void ramfb_display_update(QemuConsole *con, RAMFBState *s); -RAMFBState *ramfb_setup(DeviceState *dev, Error **errp); +RAMFBState *ramfb_setup(Error **errp); =20 /* ramfb-standalone.c */ #define TYPE_RAMFB_DEVICE "ramfb" diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c index d76a9d0fe2c9..b18db97eeb1b 100644 --- a/hw/display/ramfb-standalone.c +++ b/hw/display/ramfb-standalone.c @@ -3,7 +3,6 @@ #include "qemu/module.h" #include "hw/loader.h" #include "hw/qdev-properties.h" -#include "hw/isa/isa.h" #include "hw/display/ramfb.h" #include "ui/console.h" =20 @@ -13,8 +12,6 @@ typedef struct RAMFBStandaloneState { SysBusDevice parent_obj; QemuConsole *con; RAMFBState *state; - uint32_t xres; - uint32_t yres; } RAMFBStandaloneState; =20 static void display_update_wrapper(void *dev) @@ -37,22 +34,15 @@ static void ramfb_realizefn(DeviceState *dev, Error **e= rrp) RAMFBStandaloneState *ramfb =3D RAMFB(dev); =20 ramfb->con =3D graphic_console_init(dev, 0, &wrapper_ops, dev); - ramfb->state =3D ramfb_setup(dev, errp); + ramfb->state =3D ramfb_setup(errp); } =20 -static Property ramfb_properties[] =3D { - DEFINE_PROP_UINT32("xres", RAMFBStandaloneState, xres, 0), - DEFINE_PROP_UINT32("yres", RAMFBStandaloneState, yres, 0), - DEFINE_PROP_END_OF_LIST(), -}; - static void ramfb_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->realize =3D ramfb_realizefn; - device_class_set_props(dc, ramfb_properties); dc->desc =3D "ram framebuffer standalone device"; dc->user_creatable =3D true; } diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c index 7ba07c80f6e1..bd4746dc1768 100644 --- a/hw/display/ramfb.c +++ b/hw/display/ramfb.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu/option.h" #include "hw/loader.h" #include "hw/display/ramfb.h" #include "ui/console.h" @@ -31,7 +30,6 @@ struct QEMU_PACKED RAMFBCfg { struct RAMFBState { DisplaySurface *ds; uint32_t width, height; - uint32_t starting_width, starting_height; struct RAMFBCfg cfg; bool locked; }; @@ -117,11 +115,9 @@ static void ramfb_reset(void *opaque) RAMFBState *s =3D (RAMFBState *)opaque; s->locked =3D false; memset(&s->cfg, 0, sizeof(s->cfg)); - s->cfg.width =3D s->starting_width; - s->cfg.height =3D s->starting_height; } =20 -RAMFBState *ramfb_setup(DeviceState* dev, Error **errp) +RAMFBState *ramfb_setup(Error **errp) { FWCfgState *fw_cfg =3D fw_cfg_find(); RAMFBState *s; @@ -133,16 +129,6 @@ RAMFBState *ramfb_setup(DeviceState* dev, Error **errp) =20 s =3D g_new0(RAMFBState, 1); =20 - const char *s_fb_width =3D qemu_opt_get(dev->opts, "xres"); - const char *s_fb_height =3D qemu_opt_get(dev->opts, "yres"); - if (s_fb_width) { - s->cfg.width =3D atoi(s_fb_width); - s->starting_width =3D s->cfg.width; - } - if (s_fb_height) { - s->cfg.height =3D atoi(s_fb_height); - s->starting_height =3D s->cfg.height; - } s->locked =3D false; =20 rom_add_vga("vgabios-ramfb.bin"); diff --git a/hw/vfio/display.c b/hw/vfio/display.c index f4977c66e1b5..a57a22674d62 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -353,7 +353,7 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev= , Error **errp) &vfio_display_dmabuf_ops, vdev); if (vdev->enable_ramfb) { - vdev->dpy->ramfb =3D ramfb_setup(DEVICE(vdev), errp); + vdev->dpy->ramfb =3D ramfb_setup(errp); } vfio_display_edid_init(vdev); return 0; @@ -479,7 +479,7 @@ static int vfio_display_region_init(VFIOPCIDevice *vdev= , Error **errp) &vfio_display_region_ops, vdev); if (vdev->enable_ramfb) { - vdev->dpy->ramfb =3D ramfb_setup(DEVICE(vdev), errp); + vdev->dpy->ramfb =3D ramfb_setup(errp); } return 0; } diff --git a/stubs/ramfb.c b/stubs/ramfb.c index 0799093a5d6e..48143f33542f 100644 --- a/stubs/ramfb.c +++ b/stubs/ramfb.c @@ -6,7 +6,7 @@ void ramfb_display_update(QemuConsole *con, RAMFBState *s) { } =20 -RAMFBState *ramfb_setup(DeviceState* dev, Error **errp) +RAMFBState *ramfb_setup(Error **errp) { error_setg(errp, "ramfb support not available"); return NULL; --=20 2.18.2 From nobody Sat May 18 10:48:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588161233; cv=none; d=zohomail.com; s=zohoarc; b=oJYEFWYpzr8cQyGOwFpiIIcVLlxXPRbZyNFSKC6yYx0f/qJe8y6Kfd6CcZyhhfUdOmF4GOqvo34Sa2M/5S3q/XAOkWfVTsk1fDzthj0QsELQFXsfz4k/Yd3uLcL+qYrCFWcsNF8MiepErXmEG5DFjQHxX5FUhESx73un5QEWUKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588161233; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=lDXYPiQCE75Oc34pPrtAqolaDeqROJMdOx2Dqa0OP4M=; b=YRO7MQCp8P7QyGpFPvR5clmecLqy62mRnZ6yNunMghDzzCIlBSg9KTCiPgkHMAn0BkSMMd9AATD4eQGCDCTAJQdLyDL6KppWqrKFnEMPjRsTGg8ER2Lshq0c6f1nIxv0HdJnmKFC1Sd7qfhtQCjdni4TBDeHX/b9mVv7Uzb3B2Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588161233682669.8643453409605; Wed, 29 Apr 2020 04:53:53 -0700 (PDT) Received: from localhost ([::1]:45874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlHk-0007YV-AD for importer@patchew.org; Wed, 29 Apr 2020 07:53:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50882) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlGj-0005sU-5F for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTlGi-0001zF-0A for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:48 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:43834 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTlGh-0001yd-Fe for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-wwAqqk_tPU6NeR9BfSapkw-1; Wed, 29 Apr 2020 07:52:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1D21108BD0A; Wed, 29 Apr 2020 11:52:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-193.ams2.redhat.com [10.36.113.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id C59C160BF4; Wed, 29 Apr 2020 11:52:37 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 07FF89D9B; Wed, 29 Apr 2020 13:52:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588161166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lDXYPiQCE75Oc34pPrtAqolaDeqROJMdOx2Dqa0OP4M=; b=IECl3l+yYEswS7EeHJBj3T1LVL5Pm+VdKTBvfsOVKa6v9aaA/PrFNdrMF6nAvDbc6rZX93 aFUNqZ2vhcyNbBL/rXzVXu2e2u/DkgHMo8jHiUL2wU3mg+o60KAvqvZI6qiOGvQfYxZdUA 3wszY4NrsIkvXRuqOBJFKctBVahmpdA= X-MC-Unique: wwAqqk_tPU6NeR9BfSapkw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] Revert "hw/display/ramfb: lock guest resolution after it's set" Date: Wed, 29 Apr 2020 13:52:32 +0200 Message-Id: <20200429115236.28709-3-kraxel@redhat.com> In-Reply-To: <20200429115236.28709-1-kraxel@redhat.com> References: <20200429115236.28709-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 00:53:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alex Williamson , lersek@redhat.com, Gerd Hoffmann , hqm03ster@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit a9e0cb67b7f4c485755659f9b764c38b5f970de4. This breaks OVMF. Reproducer: Just hit 'ESC' at early boot to enter firmware setup. OVMF wants switch from (default) 800x600 to 640x480 for that, and this patch blocks it. Cc: Hou Qiming Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- hw/display/ramfb.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c index bd4746dc1768..9d41c2ad2868 100644 --- a/hw/display/ramfb.c +++ b/hw/display/ramfb.c @@ -31,7 +31,6 @@ struct RAMFBState { DisplaySurface *ds; uint32_t width, height; struct RAMFBCfg cfg; - bool locked; }; =20 static void ramfb_unmap_display_surface(pixman_image_t *image, void *unuse= d) @@ -72,25 +71,18 @@ static DisplaySurface *ramfb_create_display_surface(int= width, int height, static void ramfb_fw_cfg_write(void *dev, off_t offset, size_t len) { RAMFBState *s =3D dev; - uint32_t fourcc, format, width, height; + uint32_t fourcc, format; hwaddr stride, addr; =20 - width =3D be32_to_cpu(s->cfg.width); - height =3D be32_to_cpu(s->cfg.height); + s->width =3D be32_to_cpu(s->cfg.width); + s->height =3D be32_to_cpu(s->cfg.height); stride =3D be32_to_cpu(s->cfg.stride); fourcc =3D be32_to_cpu(s->cfg.fourcc); addr =3D be64_to_cpu(s->cfg.addr); format =3D qemu_drm_format_to_pixman(fourcc); =20 fprintf(stderr, "%s: %dx%d @ 0x%" PRIx64 "\n", __func__, - width, height, addr); - if (s->locked) { - fprintf(stderr, "%s: resolution locked, change rejected\n", __func= __); - return; - } - s->locked =3D true; - s->width =3D width; - s->height =3D height; + s->width, s->height, addr); s->ds =3D ramfb_create_display_surface(s->width, s->height, format, stride, addr); } @@ -110,13 +102,6 @@ void ramfb_display_update(QemuConsole *con, RAMFBState= *s) dpy_gfx_update_full(con); } =20 -static void ramfb_reset(void *opaque) -{ - RAMFBState *s =3D (RAMFBState *)opaque; - s->locked =3D false; - memset(&s->cfg, 0, sizeof(s->cfg)); -} - RAMFBState *ramfb_setup(Error **errp) { FWCfgState *fw_cfg =3D fw_cfg_find(); @@ -129,12 +114,9 @@ RAMFBState *ramfb_setup(Error **errp) =20 s =3D g_new0(RAMFBState, 1); =20 - s->locked =3D false; - rom_add_vga("vgabios-ramfb.bin"); fw_cfg_add_file_callback(fw_cfg, "etc/ramfb", NULL, ramfb_fw_cfg_write, s, &s->cfg, sizeof(s->cfg), false); - qemu_register_reset(ramfb_reset, s); return s; } --=20 2.18.2 From nobody Sat May 18 10:48:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588161233; cv=none; d=zohomail.com; s=zohoarc; b=c257M9h1W9bTrBr4dVhCmhGinNNg0FY70Wp9x7LJjdnNSkD2nLdgVRdepO6gFJrfIJvD2uKLApEYIY0q7ZMoPmd2+Hk2B/vDtc4tSUaOEZENzIRIn+TkdJ7Vkl2uHMqk5uxoPU9qFlFXDRPLY788FgSZ/zzVNYQ5uqzEEH/rsiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588161233; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8HzfMaz5xTJAgTkcw7l/JDpnlBvQ2/56TeX1FDlCG+s=; b=E2F+m/kBBY5Lu6+3hyf5TiYyQaq/aK3BcZd02md2WJWTVtu2VlyDH7++XPTuhIz8a6MxzofdcyX+m6+FNQvOPqCd1X3jKcmxxleP8LhE+DRBJvZ2W5tANdsPAR7XhsEVYd+mH1J/6Bk2LTY9/fX8GQJt3vPj9uSjprmihAk9/ec= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588161233303949.4349071878846; Wed, 29 Apr 2020 04:53:53 -0700 (PDT) Received: from localhost ([::1]:45856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlHk-0007YG-0l for importer@patchew.org; Wed, 29 Apr 2020 07:53:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50884) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlGj-0005sV-4w for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTlGh-0001zQ-Vw for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45109 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTlGh-0001yk-I4 for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-414-SD4R5NGEPS2NeZI-Q0u2Ww-1; Wed, 29 Apr 2020 07:52:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 531A1835B49; Wed, 29 Apr 2020 11:52:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-193.ams2.redhat.com [10.36.113.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id C30F15D9C9; Wed, 29 Apr 2020 11:52:37 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 109749D9C; Wed, 29 Apr 2020 13:52:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588161166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8HzfMaz5xTJAgTkcw7l/JDpnlBvQ2/56TeX1FDlCG+s=; b=YT2fGNdaIB+df7Y1xQ3PM95Cdbq7QdxALDOT7Y5xyB7hmCl4tUe9Dt3VvKzM2yPyGwtOT1 C6ECz+exu0+OctWRHmGn4Qjsf3EKpt/vYyciZ7OJ4HAvtHihL96/GYX56r4j8CtGgpaVLb oosgM62YXnhwrYpK4x/kD6YpWZQqJ1M= X-MC-Unique: SD4R5NGEPS2NeZI-Q0u2Ww-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] ramfb: drop leftover debug message Date: Wed, 29 Apr 2020 13:52:33 +0200 Message-Id: <20200429115236.28709-4-kraxel@redhat.com> In-Reply-To: <20200429115236.28709-1-kraxel@redhat.com> References: <20200429115236.28709-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 01:42:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alex Williamson , lersek@redhat.com, Gerd Hoffmann , hqm03ster@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/display/ramfb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c index 9d41c2ad2868..228defee5683 100644 --- a/hw/display/ramfb.c +++ b/hw/display/ramfb.c @@ -81,8 +81,6 @@ static void ramfb_fw_cfg_write(void *dev, off_t offset, s= ize_t len) addr =3D be64_to_cpu(s->cfg.addr); format =3D qemu_drm_format_to_pixman(fourcc); =20 - fprintf(stderr, "%s: %dx%d @ 0x%" PRIx64 "\n", __func__, - s->width, s->height, addr); s->ds =3D ramfb_create_display_surface(s->width, s->height, format, stride, addr); } --=20 2.18.2 From nobody Sat May 18 10:48:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588161229; cv=none; d=zohomail.com; s=zohoarc; b=I13OpVdQR+jspIl4wE+szk6prQ0cfGN0QH6yIIyiFHPnMyCkh8sT4sp7WGJTFMHHvUFordXgaYkFyKLmnuoeAQ+rB1T+7uqStaQ3AQM8SCszcjUrEnrEWEDz/CZGEVB7N+j0mUFy8Oh5+lPWtIfEbphB3X2oWu/GuArjIqi5slk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588161229; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iR/PkxKSellVCVy1YCIMxlTzekbc9CEHHA/wm6uB5xo=; b=XF5hQqdtNmY17OgeV1hy6gPCfiBM+n+JOwJmDrwMDOeGJWRKGVnNdJflO8Sovhq6XvtsWCGAxhIEySuiIfgkcrPaKepKOCIZauwlw3ZqR7JiIkqJQpgZA3eZHbLz02d9ng512twXducuBzaXqNgazNwxo0snhR3VV0ktaWnW6Ls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588161229831192.77943477845304; Wed, 29 Apr 2020 04:53:49 -0700 (PDT) Received: from localhost ([::1]:45534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlHg-0007Pj-Et for importer@patchew.org; Wed, 29 Apr 2020 07:53:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlGj-0005sT-53 for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTlGh-0001zL-W8 for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:52217 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTlGh-0001yb-GW for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-34pskwfIP--ntgo58Cj-1A-1; Wed, 29 Apr 2020 07:52:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B303804A46; Wed, 29 Apr 2020 11:52:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-193.ams2.redhat.com [10.36.113.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBAC710016E8; Wed, 29 Apr 2020 11:52:37 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 196859D9D; Wed, 29 Apr 2020 13:52:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588161165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iR/PkxKSellVCVy1YCIMxlTzekbc9CEHHA/wm6uB5xo=; b=fXB00AocEy5P5h6ofd/cYfKdKa4vk6TY9ZfH2DNVsmJD/r8dQIwGJjYHiFKTygjSZ56huq 4Q/xbzjme9uhcTAeXEIFva2zrWYojFNQpIlOQZislGE/AOroOh+mCMjleWWENV9nXb2ZCs MHBE36N2/0pjPObD0xLPzmtIcs4LS7U= X-MC-Unique: 34pskwfIP--ntgo58Cj-1A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] ramfb: don't update RAMFBState on errors Date: Wed, 29 Apr 2020 13:52:34 +0200 Message-Id: <20200429115236.28709-5-kraxel@redhat.com> In-Reply-To: <20200429115236.28709-1-kraxel@redhat.com> References: <20200429115236.28709-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 01:42:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alex Williamson , lersek@redhat.com, Gerd Hoffmann , hqm03ster@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Store width & height & surface in local variables. Update RAMFBState with the new values only in case the ramfb_create_display_surface() call succeeds. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- hw/display/ramfb.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c index 228defee5683..eb8b4bc49a2f 100644 --- a/hw/display/ramfb.c +++ b/hw/display/ramfb.c @@ -71,18 +71,25 @@ static DisplaySurface *ramfb_create_display_surface(int= width, int height, static void ramfb_fw_cfg_write(void *dev, off_t offset, size_t len) { RAMFBState *s =3D dev; - uint32_t fourcc, format; + DisplaySurface *surface; + uint32_t fourcc, format, width, height; hwaddr stride, addr; =20 - s->width =3D be32_to_cpu(s->cfg.width); - s->height =3D be32_to_cpu(s->cfg.height); - stride =3D be32_to_cpu(s->cfg.stride); - fourcc =3D be32_to_cpu(s->cfg.fourcc); - addr =3D be64_to_cpu(s->cfg.addr); - format =3D qemu_drm_format_to_pixman(fourcc); + width =3D be32_to_cpu(s->cfg.width); + height =3D be32_to_cpu(s->cfg.height); + stride =3D be32_to_cpu(s->cfg.stride); + fourcc =3D be32_to_cpu(s->cfg.fourcc); + addr =3D be64_to_cpu(s->cfg.addr); + format =3D qemu_drm_format_to_pixman(fourcc); =20 - s->ds =3D ramfb_create_display_surface(s->width, s->height, - format, stride, addr); + surface =3D ramfb_create_display_surface(width, height, + format, stride, addr); + if (!surface) + return; + + s->width =3D width; + s->height =3D height; + s->ds =3D surface; } =20 void ramfb_display_update(QemuConsole *con, RAMFBState *s) --=20 2.18.2 From nobody Sat May 18 10:48:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588161408; cv=none; d=zohomail.com; s=zohoarc; b=RGD8XLqrz+Nzqhzqt2WQmZL9iZQY7wsMluq2RVcSVMNVIs3DoTSXfqUBA8ucYyJiDLlhkJtBBGanxfeNdMhsHKfcsyigV0qKPWqZ3QpvD337gDF0mXxNcZHUl10wrfd2uuRHQA2B5xKNdgNMPin3eCWuy8UlaQ9lZIstCfX6g5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588161408; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=fOuUDLYZ45AHPnCIWp/al4iAPJBJrcFw0e2TQJnEVQk=; b=XdkzKJBXmCAkRkJilUssxxUKgdrUDMaKjeGxTYK9g8plaRJSk4qyB9A66cYZmtlX+NoN/c5lt8R+yJraevUrA1jLnTUks1IvXzVeR8TWeBsKqrn1sL6+GiAXVmxwXvuGCmPxbM3GDxzA1z51HqY7RWTSziWF6wRWaEBDhY0Y3iM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588161408293316.21955298825947; Wed, 29 Apr 2020 04:56:48 -0700 (PDT) Received: from localhost ([::1]:58754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlKY-0004fE-US for importer@patchew.org; Wed, 29 Apr 2020 07:56:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50904) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlGn-0005zd-KW for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTlGn-00020U-7B for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32746 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTlGm-00020L-Re for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-XlklErG0NqWY5YyvuKxcZw-1; Wed, 29 Apr 2020 07:52:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B04FB107ACCD; Wed, 29 Apr 2020 11:52:49 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-193.ams2.redhat.com [10.36.113.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44B4E66064; Wed, 29 Apr 2020 11:52:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 220C29D9E; Wed, 29 Apr 2020 13:52:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588161172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fOuUDLYZ45AHPnCIWp/al4iAPJBJrcFw0e2TQJnEVQk=; b=UHITsNIphWlVrhj2R9VmPJ9bOrjqiyJubEZCURCNz27HM8+5kZ5TPSJXJx6oNxOGruDvus 3jkFJko67dblVsZe2JxOGIH60srbwVGc7cMx4r0OHDjRXYqP3VRWIQtDuwcrdu3EC+6654 Q81xTCOh4r3R22N7lD918qbpCT1d/SA= X-MC-Unique: XlklErG0NqWY5YyvuKxcZw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] ramfb: add sanity checks to ramfb_create_display_surface Date: Wed, 29 Apr 2020 13:52:35 +0200 Message-Id: <20200429115236.28709-6-kraxel@redhat.com> In-Reply-To: <20200429115236.28709-1-kraxel@redhat.com> References: <20200429115236.28709-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 01:18:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alex Williamson , lersek@redhat.com, Gerd Hoffmann , hqm03ster@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- hw/display/ramfb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c index eb8b4bc49a2f..be884c9ea837 100644 --- a/hw/display/ramfb.c +++ b/hw/display/ramfb.c @@ -15,6 +15,7 @@ #include "qapi/error.h" #include "hw/loader.h" #include "hw/display/ramfb.h" +#include "hw/display/bochs-vbe.h" /* for limits */ #include "ui/console.h" #include "sysemu/reset.h" =20 @@ -49,6 +50,11 @@ static DisplaySurface *ramfb_create_display_surface(int = width, int height, hwaddr size; void *data; =20 + if (width < 16 || width > VBE_DISPI_MAX_XRES || + height < 16 || height > VBE_DISPI_MAX_YRES || + format =3D=3D 0 /* unknown format */) + return NULL; + if (linesize =3D=3D 0) { linesize =3D width * PIXMAN_FORMAT_BPP(format) / 8; } --=20 2.18.2 From nobody Sat May 18 10:48:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588161476; cv=none; d=zohomail.com; s=zohoarc; b=j2nRGKy2tznMcEC1PWrcBXhMPcDBxd3Ex8bIa9r9wKYucD4W76ETyjrdQ3gtqkt2e+yHg0jVRyeTh8VScqrHim6znZrIB3GioRrrN37kBcuJSe+WCPDK8J5SGDoWe0mG+ZLJDyBSg1e3VSNoWDV/aNitnr5F89Pac20ryrGIPRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588161476; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=d4q+KifWSZPbMSYrgLgimhuL+cOeqDgd6Vd41sgzUZY=; b=h7ILSDfRgIKrGiO0CfoKDF9Klv6TKA66kjITVaXPDglkwbqCQKdVFlQwLyLTtMVrx+YGi8IER8k3P9l5C4jFzXaTbyZ/+NIBF3wGVRRbVytMK9K4HTUKRG77lBKxVphpTmgZwcES9hpvBBQ/0zS1rzJ6JfWP4la0n5yb1gv+NdE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588161476306889.7857671581733; Wed, 29 Apr 2020 04:57:56 -0700 (PDT) Received: from localhost ([::1]:35040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlLe-0006TS-Tg for importer@patchew.org; Wed, 29 Apr 2020 07:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50910) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTlGq-000679-5C for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTlGp-00020q-JG for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46817 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jTlGp-00020j-6G for qemu-devel@nongnu.org; Wed, 29 Apr 2020 07:52:55 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-BXJ98XCWODeT-r7X1NVrTQ-1; Wed, 29 Apr 2020 07:52:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C71E1005510; Wed, 29 Apr 2020 11:52:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-193.ams2.redhat.com [10.36.113.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AB725C1BE; Wed, 29 Apr 2020 11:52:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2A9989D9F; Wed, 29 Apr 2020 13:52:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588161174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d4q+KifWSZPbMSYrgLgimhuL+cOeqDgd6Vd41sgzUZY=; b=NPXMb3drjEkHlk+kBA1phkp7iRbWR72UigrMN3S8Oo5x6V73XieyvXEyBrGHcbKdpnviQo 79b9WcPzzwKUbbHVxNlFQnTZFIguHGUGVeTM9Q2qJ8VXNbF/Aw7VC9XGykHOl7P7FisQrV yKMkKm32o7b1x1lm3G8dG4W7lZFeyVA= X-MC-Unique: BXJ98XCWODeT-r7X1NVrTQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] ramfb: fix size calculation Date: Wed, 29 Apr 2020 13:52:36 +0200 Message-Id: <20200429115236.28709-7-kraxel@redhat.com> In-Reply-To: <20200429115236.28709-1-kraxel@redhat.com> References: <20200429115236.28709-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/29 01:42:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alex Williamson , lersek@redhat.com, Gerd Hoffmann , hqm03ster@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" size calculation isn't correct with guest-supplied stride, the last display line isn't accounted for correctly. For the typical case of stride > linesize (add padding) we error on the safe side (calculated size is larger than actual size). With stride < linesize (scanlines overlap) the calculated size is smaller than the actual size though so our guest memory mapping might end up being too small. While being at it also fix ramfb_create_display_surface to use hwaddr for the parameters. That way all calculation are done with hwaddr type and we can't get funny effects from type castings. Signed-off-by: Gerd Hoffmann Acked-by: Laszlo Ersek --- hw/display/ramfb.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c index be884c9ea837..928d74d10bc7 100644 --- a/hw/display/ramfb.c +++ b/hw/display/ramfb.c @@ -44,10 +44,10 @@ static void ramfb_unmap_display_surface(pixman_image_t = *image, void *unused) =20 static DisplaySurface *ramfb_create_display_surface(int width, int height, pixman_format_code_t f= ormat, - int linesize, uint64_t= addr) + hwaddr stride, hwaddr = addr) { DisplaySurface *surface; - hwaddr size; + hwaddr size, mapsize, linesize; void *data; =20 if (width < 16 || width > VBE_DISPI_MAX_XRES || @@ -55,19 +55,20 @@ static DisplaySurface *ramfb_create_display_surface(int= width, int height, format =3D=3D 0 /* unknown format */) return NULL; =20 - if (linesize =3D=3D 0) { - linesize =3D width * PIXMAN_FORMAT_BPP(format) / 8; + linesize =3D width * PIXMAN_FORMAT_BPP(format) / 8; + if (stride =3D=3D 0) { + stride =3D linesize; } =20 - size =3D (hwaddr)linesize * height; - data =3D cpu_physical_memory_map(addr, &size, false); - if (size !=3D (hwaddr)linesize * height) { - cpu_physical_memory_unmap(data, size, 0, 0); + mapsize =3D size =3D stride * (height - 1) + linesize; + data =3D cpu_physical_memory_map(addr, &mapsize, false); + if (size !=3D mapsize) { + cpu_physical_memory_unmap(data, mapsize, 0, 0); return NULL; } =20 surface =3D qemu_create_displaysurface_from(width, height, - format, linesize, data); + format, stride, data); pixman_image_set_destroy_function(surface->image, ramfb_unmap_display_surface, NULL); =20 --=20 2.18.2