SHA256
1
0
forked from pool/qemu
qemu/modules-quick-fix-a-fundamental-error-in.patch
José Ricardo Ziviani 9a6945b9db Accepting request 919603 from home:jziviani:branches:Virtualization
- Fix testsuite dependencies (bsc#1190573)
* Patches added:
  modules-quick-fix-a-fundamental-error-in.patch

OBS-URL: https://build.opensuse.org/request/show/919603
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=674
2021-09-16 23:21:22 +00:00

89 lines
2.8 KiB
Diff

From: "Jose R. Ziviani" <jziviani@suse.de>
Date: Thu, 16 Sep 2021 00:52:34 -0300
Subject: modules: quick-fix a fundamental error in modules
Git-commit: 00000000000000000000000000000000000000000
References: bsc#1190573
modinfo.c is generated regarding the arch being built. However, if we
build multiple arch targets at once, modinfo.c will list modules that
might not be supported by all these targets. When trying to run these
targets, errors[1] will appear.
This patch is a bandaid specific to s390x. It will be removed as soon
as a better approach is fixed upstream.
[1]
$ qemu-system-s390x -nodefaults -display none -accel qtest -M none -device help
Failed to open module: /home/jose/qemu/build/hw-display-virtio-vga.so: undefined symbol: vmstate_vga_common
Signed-off-by: Jose R. Ziviani <jziviani@suse.de>
---
include/qemu/module.h | 1 +
util/module.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/include/qemu/module.h b/include/qemu/module.h
index 3deac0078b9d4d62d0549427b7ec..49d46532000e8c7211d43f7b705c 100644
--- a/include/qemu/module.h
+++ b/include/qemu/module.h
@@ -73,6 +73,7 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail);
void module_load_qom_one(const char *type);
void module_load_qom_all(void);
void module_allow_arch(const char *arch);
+bool s390x_blocklist(const char *name);
/**
* DOC: module info annotation macros
diff --git a/util/module.c b/util/module.c
index 6bb4ad915a1c86f1601a4913a29c..8370d4c6209eda4319342b202f6b 100644
--- a/util/module.c
+++ b/util/module.c
@@ -119,6 +119,35 @@ static const QemuModinfo module_info_stub[] = { {
static const QemuModinfo *module_info = module_info_stub;
static const char *module_arch;
+bool s390x_blocklist(const char *name)
+{
+ const char *blocklist[] = {
+ "hw-display-qxl",
+ "hw-display-virtio-vga",
+ "hw-display-virtio-vga-gl",
+ "hw-usb-host",
+ "hw-usb-redirect",
+ "hw-usb-smartcard"
+ };
+
+ const size_t len = sizeof(blocklist) / sizeof(blocklist[0]);
+
+ if (strcmp(module_arch, "x86_64") == 0 ||
+ strcmp(module_arch, "i386") == 0 ||
+ strcmp(module_arch, "arm") == 0 ||
+ strcmp(module_arch, "aarch64") == 0) {
+ return false;
+ }
+
+ for (size_t i = 0; i < len; i++) {
+ if (strcmp(blocklist[i], name) == 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void module_init_info(const QemuModinfo *info)
{
module_info = info;
@@ -131,6 +160,10 @@ void module_allow_arch(const char *arch)
static bool module_check_arch(const QemuModinfo *modinfo)
{
+ if (modinfo->name && s390x_blocklist(modinfo->name)) {
+ return false;
+ }
+
if (modinfo->arch) {
if (!module_arch) {
/* no arch set -> ignore all */