SHA256
1
0
forked from pool/qemu

Accepting request 867740 from home:bfrogers:branches:Virtualization

- Additional tweaks to ensure libvirt runs ok when
  qemu-hw-display-virtio-gpu package is not installed

OBS-URL: https://build.opensuse.org/request/show/867740
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=611
This commit is contained in:
Bruce Rogers 2021-01-29 15:02:11 +00:00 committed by Git OBS Bridge
parent 643d32ed8f
commit c534faa16f
4 changed files with 42 additions and 7 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:336893b5cf72b73b6cca9f9b6764b8efeaa388dbd77b72c46105e58454255a76
size 43256
oid sha256:f1253b975d29c6b84bbf3f611dbd98fcc2c4193fe76fed6db85dbcaf8b2bc696
size 43464

View File

@ -4,16 +4,17 @@ Subject: module: for virtio-gpu, pre-load module to avoid abort on missing
module
If the hw-display-virtio-gpu module is not loadable when the virtio-gpu
device is on the command line or being added in monitor, qemu will call
abort. We can fail gracefully by doing the module load in a context
which is set up to handle errors properly. (bsc#1181103)
device is referenced either on the command line or the monitor, qemu
will call abort. We can fail gracefully by moving the attempted module
load to a context better situated to handle errors properly. (bsc#1181103)
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
include/qemu/module.h | 1 +
qom/object.c | 12 ++++++++++++
qom/qom-qmp-cmds.c | 17 +++++++++++++++++
softmmu/qdev-monitor.c | 15 +++++++++++++++
3 files changed, 28 insertions(+)
4 files changed, 45 insertions(+)
diff --git a/include/qemu/module.h b/include/qemu/module.h
index 944d403cbd1535cc121af76a94f2..4b42dd285eeac1ba12e5c9e18ac0 100644
@ -49,6 +50,34 @@ index 10653552334549241cd5672d7a02..6f301fec34d103b0b07bc41d107c 100644
void object_initialize(void *data, size_t size, const char *typename)
{
TypeImpl *type = type_get_by_name(typename);
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
index 310ab2d0481d1517b0432be23256..cf130dc875bb6a7921fd7fb5af26 100644
--- a/qom/qom-qmp-cmds.c
+++ b/qom/qom-qmp-cmds.c
@@ -131,6 +131,23 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
ObjectPropertyIterator iter;
ObjectPropertyInfoList *prop_list = NULL;
+#ifdef CONFIG_MODULES
+ if (!strcmp(typename, "virtio-gpu-pci") || !strcmp(typename, "virtio-gpu-ccw")) {
+ if (module_load_check("virtio-gpu-device")) {
+ ObjectPropertyInfo *info;
+ info = g_new0(ObjectPropertyInfo, 1);
+ info->name = g_strdup("dummy");
+ info->type = g_strdup("dummy");
+ info->has_description = false;
+ info->description = NULL;
+ info->default_value = 0;
+ info->has_default_value = 0;
+ QAPI_LIST_PREPEND(prop_list, info);
+ return prop_list;
+ }
+ }
+#endif
+
klass = module_object_class_by_name(typename);
if (klass == NULL) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index bf79d0bbcd986320eb609f37253e..564dfaeeda9c3ae9dbf1afa97825 100644
--- a/softmmu/qdev-monitor.c

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jan 29 14:41:19 UTC 2021 - Bruce Rogers <brogers@suse.com>
- Additional tweaks to ensure libvirt runs ok when
qemu-hw-display-virtio-gpu package is not installed
-------------------------------------------------------------------
Fri Jan 29 02:47:35 UTC 2021 - Lin Ma <lma@suse.com>

View File

@ -6,7 +6,7 @@ When qemu is built with modules, but a given module doesn't load
qemu should handle that gracefully. When chardev-spice.so isn't
able to be loaded and qemu is invoked with -display spice-app,
qemu will reach an abort call. Explicitly detect these conditions
and error out in a normal way before we reach that code.
and error out in a normal way before we reach the abort.
Signed-off-by: Bruce Rogers <brogers@suse.com>
---