From nobody Wed Nov 5 16:54:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535958029666409.70977516117443; Mon, 3 Sep 2018 00:00:29 -0700 (PDT) Received: from localhost ([::1]:43805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwiqV-000413-1O for importer@patchew.org; Mon, 03 Sep 2018 03:00:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwio9-0001mr-9C for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwio8-0008Hu-Hi for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36364 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwio4-0008BO-2q; Mon, 03 Sep 2018 02:57:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 220D340216E9; Mon, 3 Sep 2018 06:57:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8BD61055535; Mon, 3 Sep 2018 06:57:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F02F09B1A; Mon, 3 Sep 2018 08:57:45 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 3 Sep 2018 08:57:41 +0200 Message-Id: <20180903065745.23055-2-kraxel@redhat.com> In-Reply-To: <20180903065745.23055-1-kraxel@redhat.com> References: <20180903065745.23055-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/5] virtio-vga: fix reset 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: "Michael S. Tsirkin" , Igor Mitsyanko , Alistair Francis , qemu-arm@nongnu.org, Gerd Hoffmann , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We must call the reset functions for both virtio-gpu and vga to properly reset the combo device. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20180821111313.27792-2-kraxel@redhat.com --- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu.c | 2 +- hw/display/virtio-vga.c | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index d0321672f4..a718b7233f 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -150,6 +150,7 @@ extern const GraphicHwOps virtio_gpu_ops; } while (0) =20 /* virtio-gpu.c */ +void virtio_gpu_reset(VirtIODevice *vdev); void virtio_gpu_ctrl_response(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd, struct virtio_gpu_ctrl_hdr *resp, diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 3ddd29c0de..d6c9b02b86 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1289,7 +1289,7 @@ static void virtio_gpu_instance_init(Object *obj) { } =20 -static void virtio_gpu_reset(VirtIODevice *vdev) +void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 701d980872..50c72f26f4 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -179,8 +179,12 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_de= v, Error **errp) static void virtio_vga_reset(DeviceState *dev) { VirtIOVGA *vvga =3D VIRTIO_VGA(dev); - vvga->vdev.enable =3D 0; =20 + /* reset virtio-gpu */ + virtio_gpu_reset(VIRTIO_DEVICE(&vvga->vdev)); + + /* reset vga */ + vga_common_reset(&vvga->vga); vga_dirty_log_start(&vvga->vga); } =20 --=20 2.9.3 From nobody Wed Nov 5 16:54:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535958016356892.0363768608105; Mon, 3 Sep 2018 00:00:16 -0700 (PDT) Received: from localhost ([::1]:43804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwiqE-0003tf-CS for importer@patchew.org; Mon, 03 Sep 2018 03:00:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwio9-0001nH-KD for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwio8-0008I1-JG for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33488 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwio4-0008Bk-3w; Mon, 03 Sep 2018 02:57:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A4C287A76; Mon, 3 Sep 2018 06:57:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8F757C47; Mon, 3 Sep 2018 06:57:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 07E739B1B; Mon, 3 Sep 2018 08:57:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 3 Sep 2018 08:57:42 +0200 Message-Id: <20180903065745.23055-3-kraxel@redhat.com> In-Reply-To: <20180903065745.23055-1-kraxel@redhat.com> References: <20180903065745.23055-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/5] Revert "virtio-gpu: fix crashes upon warm reboot with vga mode" 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: "Michael S. Tsirkin" , Igor Mitsyanko , Alistair Francis , qemu-arm@nongnu.org, Gerd Hoffmann , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This reverts commit 93f874fe9dbe0b997b5a9459840957efd13d7191. Now with virtio-vga being resetted properly the crash workaround is not needed any more. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20180821111313.27792-3-kraxel@redhat.com --- include/hw/virtio/virtio-gpu.h | 1 - hw/display/virtio-gpu.c | 5 ----- hw/display/virtio-vga.c | 11 ----------- 3 files changed, 17 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index a718b7233f..2374f022e8 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -125,7 +125,6 @@ typedef struct VirtIOGPU { uint32_t bytes_3d; } stats; =20 - void (*disable_scanout)(struct VirtIOGPU *g, int scanout_id); Error *migration_blocker; } VirtIOGPU; =20 diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index d6c9b02b86..1cc953006f 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -421,11 +421,6 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, i= nt scanout_id) scanout->height ?: 480, "Guest disabled display."); } - - if (g->disable_scanout) { - g->disable_scanout(g, scanout_id); - } - dpy_gfx_replace_surface(scanout->con, ds); scanout->resource_id =3D 0; scanout->ds =3D NULL; diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 50c72f26f4..1e601c1a3b 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -75,16 +75,6 @@ static void virtio_vga_gl_block(void *opaque, bool block) } } =20 -static void virtio_vga_disable_scanout(VirtIOGPU *g, int scanout_id) -{ - VirtIOVGA *vvga =3D container_of(g, VirtIOVGA, vdev); - - if (scanout_id =3D=3D 0) { - /* reset surface if needed */ - vvga->vga.graphic_mode =3D -1; - } -} - static const GraphicHwOps virtio_vga_ops =3D { .invalidate =3D virtio_vga_invalidate_display, .gfx_update =3D virtio_vga_update_display, @@ -166,7 +156,6 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev= , Error **errp) vvga->vga_mrs, true); =20 vga->con =3D g->scanout[0].con; - g->disable_scanout =3D virtio_vga_disable_scanout; graphic_console_set_hwops(vga->con, &virtio_vga_ops, vvga); =20 for (i =3D 0; i < g->conf.max_outputs; i++) { --=20 2.9.3 From nobody Wed Nov 5 16:54:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535958258906648.5175475153783; Mon, 3 Sep 2018 00:04:18 -0700 (PDT) Received: from localhost ([::1]:43829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwiuH-000071-ND for importer@patchew.org; Mon, 03 Sep 2018 03:04:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwioA-0001qG-Ad for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:58:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwio9-0008Ib-2j for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50636 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwio4-0008Bs-31; Mon, 03 Sep 2018 02:57:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97863801145A; Mon, 3 Sep 2018 06:57:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8DB12026D6B; Mon, 3 Sep 2018 06:57:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 17D879B1C; Mon, 3 Sep 2018 08:57:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 3 Sep 2018 08:57:43 +0200 Message-Id: <20180903065745.23055-4-kraxel@redhat.com> In-Reply-To: <20180903065745.23055-1-kraxel@redhat.com> References: <20180903065745.23055-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 3/5] use dpy_gfx_update_full 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: "Michael S. Tsirkin" , Igor Mitsyanko , Alistair Francis , qemu-arm@nongnu.org, Gerd Hoffmann , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Message-id: 20180810132856.22833-1-kraxel@redhat.com --- hw/display/exynos4210_fimd.c | 4 +--- hw/display/g364fb.c | 2 +- hw/display/jazz_led.c | 3 +-- hw/display/tc6393xb.c | 4 ++-- hw/display/vga.c | 3 +-- hw/display/virtio-gpu.c | 2 +- hw/display/vmware_vga.c | 5 +---- hw/display/xlnx_dp.c | 3 +-- 8 files changed, 9 insertions(+), 17 deletions(-) diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index f011ea5b00..083b3172da 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -1272,8 +1272,6 @@ static void exynos4210_fimd_update(void *opaque) uint8_t *host_fb_addr; bool is_dirty =3D false; const int global_width =3D (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) += 1; - const int global_height =3D ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT= ) & - FIMD_VIDTCON2_SIZE_MASK) + 1; =20 if (!s || !s->console || !s->enabled || surface_bits_per_pixel(qemu_console_surface(s->console)) =3D=3D 0)= { @@ -1329,7 +1327,7 @@ static void exynos4210_fimd_update(void *opaque) fimd_copy_line_toqemu(global_width, s->ifb + global_width * li= ne * RGBA_SIZE, d + global_width * line * bpp); } - dpy_gfx_update(s->console, 0, 0, global_width, global_height); + dpy_gfx_update_full(s->console); } s->invalidate =3D false; s->vidintcon[1] |=3D FIMD_VIDINT_INTFRMPEND; diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index fbc2b2422d..8ad7e5d824 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -229,7 +229,7 @@ static void g364fb_draw_blank(G364State *s) d +=3D surface_stride(surface); } =20 - dpy_gfx_update(s->con, 0, 0, s->width, s->height); + dpy_gfx_update_full(s->con); s->blanked =3D 1; } =20 diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 3c97d56434..eb7933d2a3 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -214,8 +214,7 @@ static void jazz_led_update_display(void *opaque) } =20 s->state =3D REDRAW_NONE; - dpy_gfx_update(s->con, 0, 0, - surface_width(surface), surface_height(surface)); + dpy_gfx_update_full(s->con); } =20 static void jazz_led_invalidate_display(void *opaque) diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 8392e59493..3360be6f84 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -461,7 +461,7 @@ static void tc6393xb_draw_graphic(TC6393xbState *s, int= full_update) return; } =20 - dpy_gfx_update(s->con, 0, 0, s->scr_width, s->scr_height); + dpy_gfx_update_full(s->con); } =20 static void tc6393xb_draw_blank(TC6393xbState *s, int full_update) @@ -480,7 +480,7 @@ static void tc6393xb_draw_blank(TC6393xbState *s, int f= ull_update) d +=3D surface_stride(surface); } =20 - dpy_gfx_update(s->con, 0, 0, s->scr_width, s->scr_height); + dpy_gfx_update_full(s->con); } =20 static void tc6393xb_update_display(void *opaque) diff --git a/hw/display/vga.c b/hw/display/vga.c index 802cfd47db..3ba3f6853c 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1745,8 +1745,7 @@ static void vga_draw_blank(VGACommonState *s, int ful= l_update) memset(d, 0, w); d +=3D surface_stride(surface); } - dpy_gfx_update(s->con, 0, 0, - s->last_scr_width, s->last_scr_height); + dpy_gfx_update_full(s->con); } =20 #define GMODE_TEXT 0 diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 1cc953006f..410cf0c98a 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1182,7 +1182,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, } =20 dpy_gfx_replace_surface(scanout->con, scanout->ds); - dpy_gfx_update(scanout->con, 0, 0, scanout->width, scanout->height= ); + dpy_gfx_update_full(scanout->con); if (scanout->cursor.resource_id) { update_cursor(g, &scanout->cursor); } diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 0bbb78b9a6..afbf1c5973 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1116,7 +1116,6 @@ static inline void vmsvga_check_size(struct vmsvga_st= ate_s *s) static void vmsvga_update_display(void *opaque) { struct vmsvga_state_s *s =3D opaque; - DisplaySurface *surface; =20 if (!s->enable || !s->config) { /* in standard vga mode */ @@ -1125,15 +1124,13 @@ static void vmsvga_update_display(void *opaque) } =20 vmsvga_check_size(s); - surface =3D qemu_console_surface(s->vga.con); =20 vmsvga_fifo_run(s); vmsvga_update_rect_flush(s); =20 if (s->invalidated) { s->invalidated =3D 0; - dpy_gfx_update(s->vga.con, 0, 0, - surface_width(surface), surface_height(surface)); + dpy_gfx_update_full(s->vga.con); } } =20 diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 6439bd05ef..cc0f9bc9cc 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1186,8 +1186,7 @@ static void xlnx_dp_update_display(void *opaque) /* * XXX: We might want to update only what changed. */ - dpy_gfx_update(s->console, 0, 0, surface_width(s->g_plane.surface), - surface_height(s->g_plane.surface)); + dpy_gfx_update_full(s->console); } =20 static const GraphicHwOps xlnx_dp_gfx_ops =3D { --=20 2.9.3 From nobody Wed Nov 5 16:54:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535958161130231.76708311877894; Mon, 3 Sep 2018 00:02:41 -0700 (PDT) Received: from localhost ([::1]:43822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwisi-0005Vb-1k for importer@patchew.org; Mon, 03 Sep 2018 03:02:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwioA-0001oo-1d for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwio8-0008IK-Qr for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36372 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwio4-0008Bl-6S; Mon, 03 Sep 2018 02:57:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8355C40216EA; Mon, 3 Sep 2018 06:57:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8DE12027069; Mon, 3 Sep 2018 06:57:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2207B9B1D; Mon, 3 Sep 2018 08:57:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 3 Sep 2018 08:57:44 +0200 Message-Id: <20180903065745.23055-5-kraxel@redhat.com> In-Reply-To: <20180903065745.23055-1-kraxel@redhat.com> References: <20180903065745.23055-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 03 Sep 2018 06:57:51 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 4/5] virtio-gpu: pass down VirtIOGPU pointer to a bunch of functions 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: "Michael S. Tsirkin" , Igor Mitsyanko , Alistair Francis , qemu-arm@nongnu.org, Gerd Hoffmann , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" No functional change, just preparation for a followup patch which needs a VirtIOGPU pointer. Signed-off-by: Gerd Hoffmann Message-Id: <20180829122101.29852-2-kraxel@redhat.com> --- include/hw/virtio/virtio-gpu.h | 6 ++++-- hw/display/virtio-gpu-3d.c | 8 ++++---- hw/display/virtio-gpu.c | 25 +++++++++++++++---------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 2374f022e8..c8c599f1b9 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -159,10 +159,12 @@ void virtio_gpu_ctrl_response_nodata(VirtIOGPU *g, enum virtio_gpu_ctrl_type type); void virtio_gpu_get_display_info(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd); -int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backin= g *ab, +int virtio_gpu_create_mapping_iov(VirtIOGPU *g, + struct virtio_gpu_resource_attach_backin= g *ab, struct virtio_gpu_ctrl_command *cmd, uint64_t **addr, struct iovec **iov); -void virtio_gpu_cleanup_mapping_iov(struct iovec *iov, uint32_t count); +void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g, + struct iovec *iov, uint32_t count); void virtio_gpu_process_cmdq(VirtIOGPU *g); =20 /* virtio-gpu-3d.c */ diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 3558f38fe8..55d76405a9 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -86,7 +86,7 @@ static void virgl_cmd_resource_unref(VirtIOGPU *g, &res_iovs, &num_iovs); if (res_iovs !=3D NULL && num_iovs !=3D 0) { - virtio_gpu_cleanup_mapping_iov(res_iovs, num_iovs); + virtio_gpu_cleanup_mapping_iov(g, res_iovs, num_iovs); } virgl_renderer_resource_unref(unref.resource_id); } @@ -291,7 +291,7 @@ static void virgl_resource_attach_backing(VirtIOGPU *g, VIRTIO_GPU_FILL_CMD(att_rb); trace_virtio_gpu_cmd_res_back_attach(att_rb.resource_id); =20 - ret =3D virtio_gpu_create_mapping_iov(&att_rb, cmd, NULL, &res_iovs); + ret =3D virtio_gpu_create_mapping_iov(g, &att_rb, cmd, NULL, &res_iovs= ); if (ret !=3D 0) { cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; return; @@ -301,7 +301,7 @@ static void virgl_resource_attach_backing(VirtIOGPU *g, res_iovs, att_rb.nr_entries); =20 if (ret !=3D 0) - virtio_gpu_cleanup_mapping_iov(res_iovs, att_rb.nr_entries); + virtio_gpu_cleanup_mapping_iov(g, res_iovs, att_rb.nr_entries); } =20 static void virgl_resource_detach_backing(VirtIOGPU *g, @@ -320,7 +320,7 @@ static void virgl_resource_detach_backing(VirtIOGPU *g, if (res_iovs =3D=3D NULL || num_iovs =3D=3D 0) { return; } - virtio_gpu_cleanup_mapping_iov(res_iovs, num_iovs); + virtio_gpu_cleanup_mapping_iov(g, res_iovs, num_iovs); } =20 =20 diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 410cf0c98a..cf31b5f710 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -29,7 +29,8 @@ static struct virtio_gpu_simple_resource* virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id); =20 -static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *= res); +static void virtio_gpu_cleanup_mapping(VirtIOGPU *g, + struct virtio_gpu_simple_resource *= res); =20 static void virtio_gpu_ctrl_hdr_bswap(struct virtio_gpu_ctrl_hdr *hdr) @@ -442,7 +443,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g, } =20 pixman_image_unref(res->image); - virtio_gpu_cleanup_mapping(res); + virtio_gpu_cleanup_mapping(g, res); QTAILQ_REMOVE(&g->reslist, res, next); g->hostmem -=3D res->hostmem; g_free(res); @@ -688,7 +689,8 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, scanout->height =3D ss.r.height; } =20 -int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backin= g *ab, +int virtio_gpu_create_mapping_iov(VirtIOGPU *g, + struct virtio_gpu_resource_attach_backin= g *ab, struct virtio_gpu_ctrl_command *cmd, uint64_t **addr, struct iovec **iov) { @@ -732,7 +734,7 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_res= ource_attach_backing *ab, qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to map MMIO memory = for" " resource %d element %d\n", __func__, ab->resource_id, i); - virtio_gpu_cleanup_mapping_iov(*iov, i); + virtio_gpu_cleanup_mapping_iov(g, *iov, i); g_free(ents); *iov =3D NULL; if (addr) { @@ -746,7 +748,8 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_res= ource_attach_backing *ab, return 0; } =20 -void virtio_gpu_cleanup_mapping_iov(struct iovec *iov, uint32_t count) +void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g, + struct iovec *iov, uint32_t count) { int i; =20 @@ -757,9 +760,10 @@ void virtio_gpu_cleanup_mapping_iov(struct iovec *iov,= uint32_t count) g_free(iov); } =20 -static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *= res) +static void virtio_gpu_cleanup_mapping(VirtIOGPU *g, + struct virtio_gpu_simple_resource *= res) { - virtio_gpu_cleanup_mapping_iov(res->iov, res->iov_cnt); + virtio_gpu_cleanup_mapping_iov(g, res->iov, res->iov_cnt); res->iov =3D NULL; res->iov_cnt =3D 0; g_free(res->addrs); @@ -791,7 +795,7 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g, return; } =20 - ret =3D virtio_gpu_create_mapping_iov(&ab, cmd, &res->addrs, &res->iov= ); + ret =3D virtio_gpu_create_mapping_iov(g, &ab, cmd, &res->addrs, &res->= iov); if (ret !=3D 0) { cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; return; @@ -818,7 +822,7 @@ virtio_gpu_resource_detach_backing(VirtIOGPU *g, cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; return; } - virtio_gpu_cleanup_mapping(res); + virtio_gpu_cleanup_mapping(g, res); } =20 static void virtio_gpu_simple_process_cmd(VirtIOGPU *g, @@ -1144,6 +1148,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, hwaddr len =3D res->iov[i].iov_len; res->iov[i].iov_base =3D cpu_physical_memory_map(res->addrs[i], &len, 1); + if (!res->iov[i].iov_base || len !=3D res->iov[i].iov_len) { /* Clean up the half-a-mapping we just created... */ if (res->iov[i].iov_base) { @@ -1152,7 +1157,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, } /* ...and the mappings for previous loop iterations */ res->iov_cnt =3D i; - virtio_gpu_cleanup_mapping(res); + virtio_gpu_cleanup_mapping(g, res); pixman_image_unref(res->image); g_free(res); return -EINVAL; --=20 2.9.3 From nobody Wed Nov 5 16:54:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535958168432229.84986619385472; Mon, 3 Sep 2018 00:02:48 -0700 (PDT) Received: from localhost ([::1]:43824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwisp-0005n0-Dg for importer@patchew.org; Mon, 03 Sep 2018 03:02:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwio9-0001nG-Jc for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwio8-0008I7-Kk for qemu-devel@nongnu.org; Mon, 03 Sep 2018 02:57:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49296 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwio4-0008Cr-P7; Mon, 03 Sep 2018 02:57:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5AA5A40241C4; Mon, 3 Sep 2018 06:57:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 029B82166BA1; Mon, 3 Sep 2018 06:57:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 29D579B2E; Mon, 3 Sep 2018 08:57:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 3 Sep 2018 08:57:45 +0200 Message-Id: <20180903065745.23055-6-kraxel@redhat.com> In-Reply-To: <20180903065745.23055-1-kraxel@redhat.com> References: <20180903065745.23055-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 03 Sep 2018 06:57:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 03 Sep 2018 06:57:52 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 5/5] virtio-gpu: add iommu support 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: "Michael S. Tsirkin" , Igor Mitsyanko , Alistair Francis , qemu-arm@nongnu.org, Gerd Hoffmann , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Switch from cpu_physical_memory_map to dma_memory_map, so iommu mappings for virtio-gpu objects work properly. Signed-off-by: Gerd Hoffmann Message-Id: <20180829122101.29852-3-kraxel@redhat.com> --- hw/display/virtio-gpu.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index cf31b5f710..7be3a9d404 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -17,6 +17,7 @@ #include "qemu/iov.h" #include "ui/console.h" #include "trace.h" +#include "sysemu/dma.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-bus.h" @@ -726,7 +727,8 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g, uint32_t l =3D le32_to_cpu(ents[i].length); hwaddr len =3D l; (*iov)[i].iov_len =3D l; - (*iov)[i].iov_base =3D cpu_physical_memory_map(a, &len, 1); + (*iov)[i].iov_base =3D dma_memory_map(VIRTIO_DEVICE(g)->dma_as, + a, &len, DMA_DIRECTION_TO_DEVI= CE); if (addr) { (*addr)[i] =3D a; } @@ -754,8 +756,10 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g, int i; =20 for (i =3D 0; i < count; i++) { - cpu_physical_memory_unmap(iov[i].iov_base, iov[i].iov_len, 1, - iov[i].iov_len); + dma_memory_unmap(VIRTIO_DEVICE(g)->dma_as, + iov[i].iov_base, iov[i].iov_len, + DMA_DIRECTION_TO_DEVICE, + iov[i].iov_len); } g_free(iov); } @@ -1147,13 +1151,17 @@ static int virtio_gpu_load(QEMUFile *f, void *opaqu= e, size_t size, for (i =3D 0; i < res->iov_cnt; i++) { hwaddr len =3D res->iov[i].iov_len; res->iov[i].iov_base =3D - cpu_physical_memory_map(res->addrs[i], &len, 1); + dma_memory_map(VIRTIO_DEVICE(g)->dma_as, + res->addrs[i], &len, DMA_DIRECTION_TO_DEVIC= E); =20 if (!res->iov[i].iov_base || len !=3D res->iov[i].iov_len) { /* Clean up the half-a-mapping we just created... */ if (res->iov[i].iov_base) { - cpu_physical_memory_unmap(res->iov[i].iov_base, - len, 0, 0); + dma_memory_unmap(VIRTIO_DEVICE(g)->dma_as, + res->iov[i].iov_base, + res->iov[i].iov_len, + DMA_DIRECTION_TO_DEVICE, + res->iov[i].iov_len); } /* ...and the mappings for previous loop iterations */ res->iov_cnt =3D i; @@ -1205,11 +1213,6 @@ static void virtio_gpu_device_realize(DeviceState *q= dev, Error **errp) Error *local_err =3D NULL; int i; =20 - if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) { - error_setg(errp, "virtio-gpu does not support vIOMMU yet"); - return; - } - if (g->conf.max_outputs > VIRTIO_GPU_MAX_SCANOUTS) { error_setg(errp, "invalid max_outputs > %d", VIRTIO_GPU_MAX_SCANOU= TS); return; --=20 2.9.3