Skip to content

Commit

Permalink
Upgrade QEMU to 9.1.0
Browse files Browse the repository at this point in the history
- Upgrade QEMU to 9.1.0
- Resolve build errors in QEMU

Tracked-On: OAM-129500
Signed-off-by: Suresh, Prashanth <prashanth.suresh@intel.com>
  • Loading branch information
prashanth-intel committed Jan 16, 2025
1 parent d810f6b commit 4d33664
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From a2e4fde249d234804163744c2864975636b88f5b Mon Sep 17 00:00:00 2001
From: "Suresh, Prashanth" <prashanth.suresh@intel.com>
Date: Wed, 15 Jan 2025 17:25:59 +0000
Subject: [PATCH] Upgrade QEMU to 9.1.0

1. Upgrade QEMU to 9.1.0
2. Resolve build errors for QEMU

Signed-off-by: Suresh, Prashanth <prashanth.suresh@intel.com>
---
scripts/setup_host.sh | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/setup_host.sh b/scripts/setup_host.sh
index 4e5b74f..b831b60 100755
--- a/scripts/setup_host.sh
+++ b/scripts/setup_host.sh
@@ -9,7 +9,7 @@ set -eE

#--------- Global variable -------------------
reboot_required=0
-QEMU_REL="qemu-8.2.1"
+QEMU_REL="qemu-9.1.0"
skip_install_qemu=false

#Directory to keep versions of qemu which can be reused instead of downloading again
@@ -64,6 +64,13 @@ function ubu_install_qemu_gvt(){

cd $CIV_WORK_DIR/$QEMU_REL/

+ if [ -f "$CIV_VERTICAl_DIR/qemu/0031-Set-the-fourcc-if-it-is-0.patch" ]; then
+ mv $CIV_VERTICAl_DIR/qemu/0031-Set-the-fourcc-if-it-is-0.patch $CIV_WORK_DIR/patches/qemu/
+ fi
+ if [ -f "$CIV_VERTICAl_DIR/qemu/0033-CiV-SRIOV-virtio-gpu-power-management-qemu.patch" ]; then
+ mv $CIV_VERTICAl_DIR/qemu/0033-CiV-SRIOV-virtio-gpu-power-management-qemu.patch $CIV_WORK_DIR/patches/qemu/
+ fi
+
qemu_patch_num=$(ls $CIV_WORK_DIR/patches/qemu/*.patch 2> /dev/null | wc -l)
if [ "$qemu_patch_num" != "0" ]; then
for i in $CIV_WORK_DIR/patches/qemu/*.patch; do
--
2.34.1

74 changes: 74 additions & 0 deletions host/qemu/0001-Fix-compilation-failure-for-QEMU-9.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
From 7764aa273054bf351c834f5670b51407331b009f Mon Sep 17 00:00:00 2001
From: "Suresh, Prashanth" <prashanth.suresh@intel.com>
Date: Wed, 15 Jan 2025 22:29:08 +0530
Subject: [PATCH] Fix compilation failure for QEMU 9.1

---
include/ui/dmabuf.h | 20 +++++++++++++++++++-
ui/dmabuf.c | 19 -------------------
2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/include/ui/dmabuf.h b/include/ui/dmabuf.h
index 07e8178d7..3e217e53b 100644
--- a/include/ui/dmabuf.h
+++ b/include/ui/dmabuf.h
@@ -10,7 +10,25 @@
#ifndef DMABUF_H
#define DMABUF_H

-typedef struct QemuDmaBuf QemuDmaBuf;
+typedef struct QemuDmaBuf {
+ int fd;
+ uint32_t width;
+ uint32_t height;
+ uint32_t stride;
+ uint32_t fourcc;
+ uint64_t modifier;
+ uint32_t texture;
+ uint32_t x;
+ uint32_t y;
+ uint32_t backing_width;
+ uint32_t backing_height;
+ bool y0_top;
+ int fence_fd;
+ bool allow_fences;
+ bool render_sync;
+ bool draw_submitted;
+} QemuDmaBuf;
+

QemuDmaBuf *qemu_dmabuf_new(uint32_t width, uint32_t height,
uint32_t stride, uint32_t x,
diff --git a/ui/dmabuf.c b/ui/dmabuf.c
index 0adaea008..d8ed6731d 100644
--- a/ui/dmabuf.c
+++ b/ui/dmabuf.c
@@ -10,25 +10,6 @@
#include "qemu/osdep.h"
#include "ui/dmabuf.h"

-struct QemuDmaBuf {
- int fd;
- uint32_t width;
- uint32_t height;
- uint32_t stride;
- uint32_t fourcc;
- uint64_t modifier;
- uint32_t texture;
- uint32_t x;
- uint32_t y;
- uint32_t backing_width;
- uint32_t backing_height;
- bool y0_top;
- int fence_fd;
- bool allow_fences;
- bool render_sync;
- bool draw_submitted;
-};
-
QemuDmaBuf *qemu_dmabuf_new(uint32_t width, uint32_t height,
uint32_t stride, uint32_t x,
uint32_t y, uint32_t backing_width,
--
2.43.0

30 changes: 30 additions & 0 deletions host/qemu/0031-Set-the-fourcc-if-it-is-0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 86a0465b5065f69dd965efd94437b9858ba435ce Mon Sep 17 00:00:00 2001
From: yhe39 <yue.he@intel.com>
Date: Mon, 29 Nov 2021 11:11:27 +0800
Subject: [PATCH] Set the fourcc if it is 0

Signed-off-by: yhe39 <yue.he@intel.com>
---
ui/egl-helpers.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 42f0b45d4..e7d84febc 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -284,7 +284,11 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf)
attrs[i++] = EGL_HEIGHT;
attrs[i++] = qemu_dmabuf_get_backing_height(dmabuf);
attrs[i++] = EGL_LINUX_DRM_FOURCC_EXT;
- attrs[i++] = qemu_dmabuf_get_fourcc(dmabuf);
+ if (dmabuf->fourcc == 0) {
+ attrs[i++] = 0x34324241;
+ }
+ else
+ attrs[i++] = dmabuf->fourcc;

attrs[i++] = EGL_DMA_BUF_PLANE0_FD_EXT;
attrs[i++] = qemu_dmabuf_get_fd(dmabuf);
--
2.25.1

95 changes: 95 additions & 0 deletions host/qemu/0033-CiV-SRIOV-virtio-gpu-power-management-qemu.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
From 832cbe9d489149133fc1ebe779aa67b987bbb629 Mon Sep 17 00:00:00 2001
From: "Yuan, Hang" <hang.yuan@intel.com>
Date: Thu, 30 Jun 2022 08:29:39 +0800
Subject: [PATCH] CiV SRIOV virtio-gpu power management qemu

Tracked-On: OAM-102664
Signed-off-by: Yuan, Hang <hang.yuan@intel.com>
---
hw/display/virtio-gpu.c | 19 +++++++++++++++++++
include/hw/virtio/virtio-gpu.h | 2 ++
.../standard-headers/linux/virtio_config.h | 4 ++++
3 files changed, 25 insertions(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 25a091465..a8c46f6d8 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1336,6 +1336,7 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
&qdev->mem_reentrancy_guard);
g->reset_bh = qemu_bh_new(virtio_gpu_reset_bh, g);
+ g->suspended = false;
qemu_cond_init(&g->reset_cond);
QTAILQ_INIT(&g->reslist);
QTAILQ_INIT(&g->cmdq);
@@ -1347,6 +1348,10 @@ void virtio_gpu_reset(VirtIODevice *vdev)
struct virtio_gpu_simple_resource *res, *tmp;
struct virtio_gpu_ctrl_command *cmd;

+ if (g->suspended) {
+ return;
+ }
+
QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) {
virtio_gpu_resource_destroy(g, res);
}
@@ -1387,6 +1392,19 @@ virtio_gpu_set_config(VirtIODevice *vdev, const uint8_t *config)
}
}

+static void
+virtio_gpu_set_status(VirtIODevice *vdev, uint8_t status)
+{
+ VirtIOGPU *g = VIRTIO_GPU(vdev);
+
+ if (status == VIRTIO_CONFIG_S_SUSPEND) {
+ g->suspended = true;
+ }
+ if ((status == VIRTIO_CONFIG_S_RESUME) || (status & VIRTIO_CONFIG_S_DRIVER)) {
+ g->suspended = false;
+ }
+}
+
/*
* For historical reasons virtio_gpu does not adhere to virtio migration
* scheme as described in doc/virtio-migration.txt, in a sense that no
@@ -1439,6 +1457,7 @@ static void virtio_gpu_class_init(ObjectClass *klass, void *data)
vdc->reset = virtio_gpu_reset;
vdc->get_config = virtio_gpu_get_config;
vdc->set_config = virtio_gpu_set_config;
+ vdc->set_status = virtio_gpu_set_status;

dc->vmsd = &vmstate_virtio_gpu;
device_class_set_props(dc, virtio_gpu_properties);
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 6372f4bbb..dd9f481bc 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -159,6 +159,8 @@ typedef struct VGPUDMABuf {
struct VirtIOGPU {
VirtIOGPUBase parent_obj;

+ bool suspended;
+
uint8_t scanout_vmstate_version;
uint64_t conf_max_hostmem;

diff --git a/include/standard-headers/linux/virtio_config.h b/include/standard-headers/linux/virtio_config.h
index 22e3a85f6..30c4ed2cb 100644
--- a/include/standard-headers/linux/virtio_config.h
+++ b/include/standard-headers/linux/virtio_config.h
@@ -40,6 +40,10 @@
#define VIRTIO_CONFIG_S_DRIVER_OK 4
/* Driver has finished configuring features */
#define VIRTIO_CONFIG_S_FEATURES_OK 8
+/* Device will enter suspend state */
+#define VIRTIO_CONFIG_S_SUSPEND 0x10
+/* Device resumed */
+#define VIRTIO_CONFIG_S_RESUME 0x11
/* Device entered invalid state, driver must reset it */
#define VIRTIO_CONFIG_S_NEEDS_RESET 0x40
/* We've given up on this device. */
--
2.25.1

0 comments on commit 4d33664

Please sign in to comment.