Skip to content

Commit

Permalink
Merge pull request #400 from no92/qemu-9.1.1
Browse files Browse the repository at this point in the history
qemu: bump to 9.1.1, fix smbios bug
  • Loading branch information
avdgrinten authored Nov 3, 2024
2 parents 0b71979 + aa1f6fe commit 09ff8f0
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 56 deletions.
8 changes: 4 additions & 4 deletions bootstrap.d/app-emulation.y4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ sources:
- name: qemu
subdir: 'ports'
git: 'https://github.com/qemu/qemu.git'
tag: 'v8.1.4'
version: '8.1.4'
tag: 'v9.1.1'
version: '9.1.1'

tools:
- name: host-qemu
labels: [not-on-xbbs]
architecture: noarch
containerless: true
from_source: qemu
revision: 2
revision: 1
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down Expand Up @@ -59,7 +59,7 @@ packages:
- pixman
- ncurses
- nettle
revision: 2
revision: 1
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down
30 changes: 10 additions & 20 deletions patches/qemu/0001-configure-add-managarm-support.patch
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
From 7f32db7d8387e42c3e1128c9ff8d8e6cfa30efba Mon Sep 17 00:00:00 2001
From 00b7c9d68c5f6e8b01e8c8dcf6febb43b399682c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?=
<[email protected]>
Date: Tue, 21 Dec 2021 13:07:19 +0100
Subject: [PATCH 1/3] configure: add managarm support
Subject: [PATCH 1/5] configure: add managarm support

---
configure | 5 +++++
1 file changed, 5 insertions(+)
configure | 2 ++
1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 133f4e3..2c6f6b6 100755
index d08b71f..c0bbb66 100755
--- a/configure
+++ b/configure
@@ -365,6 +365,8 @@ elif check_define __NetBSD__; then
targetos=netbsd
@@ -353,6 +353,8 @@ elif check_define __NetBSD__; then
host_os=netbsd
elif check_define __APPLE__; then
targetos=darwin
host_os=darwin
+elif check_define __managarm__; then
+ targetos=managarm
+ host_os=managarm
else
# This is a fatal error, but don't report it yet, because we
# might be going to just print the --help text, or it might
@@ -413,6 +415,9 @@ haiku)
linux)
linux="yes"
;;
+managarm)
+ managarm="yes"
+;;
esac

if test ! -z "$cpu" ; then
--
2.43.0
2.47.0

20 changes: 11 additions & 9 deletions patches/qemu/0002-dmalog-Add-device.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 39faec5de4fda8e9d15fea32a8a3de32604bd316 Mon Sep 17 00:00:00 2001
From b46f13478bfa60da71769f543029c25c1c34cb46 Mon Sep 17 00:00:00 2001
From: Matteo Semenzato <[email protected]>
Date: Sun, 6 Aug 2023 23:29:54 +0200
Subject: [PATCH 2/3] dmalog: Add device
Subject: [PATCH 2/5] dmalog: Add device

---
hw/misc/Kconfig | 4 +
Expand All @@ -11,18 +11,20 @@ Subject: [PATCH 2/3] dmalog: Add device
create mode 100644 hw/misc/dmalog.c

diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig
index 6996d26..7f84d1c 100644
index 1e08785..52dee72 100644
--- a/hw/misc/Kconfig
+++ b/hw/misc/Kconfig
@@ -186,4 +186,8 @@ config AXP2XX_PMU
@@ -58,6 +58,10 @@ config ARM11SCU
config MOS6522
bool
depends on I2C

+config DMALOG
+ bool
+ default y
+
source macio/Kconfig
config MACIO
bool
select CUDA
diff --git a/hw/misc/dmalog.c b/hw/misc/dmalog.c
new file mode 100644
index 0000000..d7938d6
Expand Down Expand Up @@ -369,7 +371,7 @@ index 0000000..d7938d6
+}
+type_init(pci_dmalog_register_types)
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
index 892f8b9..4250eb9 100644
index 2ca8717..7f13ec9 100644
--- a/hw/misc/meson.build
+++ b/hw/misc/meson.build
@@ -1,6 +1,7 @@
Expand All @@ -379,7 +381,7 @@ index 892f8b9..4250eb9 100644
+system_ss.add(when: 'CONFIG_DMALOG', if_true: files('dmalog.c'))
system_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugexit.c'))
system_ss.add(when: 'CONFIG_ISA_TESTDEV', if_true: files('pc-testdev.c'))
system_ss.add(when: 'CONFIG_PCA9552', if_true: files('pca9552.c'))
system_ss.add(when: 'CONFIG_PCI_TESTDEV', if_true: files('pci-testdev.c'))
--
2.43.0
2.47.0

43 changes: 20 additions & 23 deletions patches/qemu/0003-Add-managarm-support.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From 923e5624fd2450895fe33a4df5a3108c1b3f0b02 Mon Sep 17 00:00:00 2001
From 520703e64241fe22153393eebe1ae9766fa7f8c7 Mon Sep 17 00:00:00 2001
From: no92 <[email protected]>
Date: Wed, 24 Jan 2024 19:34:27 +0100
Subject: [PATCH 3/3] Add managarm support
Subject: [PATCH 3/5] Add managarm support

---
block/file-posix.c | 11 +++++++++--
configure | 4 ++++
2 files changed, 13 insertions(+), 2 deletions(-)
meson.build | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 7f540b0..b06212c 100644
index ff928b5..cf32e77 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -110,6 +110,13 @@
Expand All @@ -26,7 +26,7 @@ index 7f540b0..b06212c 100644
/* OS X does not have O_DSYNC */
#ifndef O_DSYNC
#ifdef O_SYNC
@@ -1227,7 +1234,7 @@ static int hdev_get_max_hw_transfer(int fd, struct stat *st)
@@ -1217,7 +1224,7 @@ static int hdev_get_max_hw_transfer(int fd, struct stat *st)
/*
* Get a sysfs attribute value as character string.
*/
Expand All @@ -35,7 +35,7 @@ index 7f540b0..b06212c 100644
static int get_sysfs_str_val(struct stat *st, const char *attribute,
char **val) {
g_autofree char *sysfspath = NULL;
@@ -1281,7 +1288,7 @@ static int get_sysfs_zoned_model(struct stat *st, BlockZoneModel *zoned)
@@ -1271,7 +1278,7 @@ static int get_sysfs_zoned_model(struct stat *st, BlockZoneModel *zoned)
/*
* Get a sysfs attribute value as a long integer.
*/
Expand All @@ -44,21 +44,18 @@ index 7f540b0..b06212c 100644
static long get_sysfs_long_val(struct stat *st, const char *attribute)
{
g_autofree char *str = NULL;
diff --git a/configure b/configure
index 2c6f6b6..4f3c603 100755
--- a/configure
+++ b/configure
@@ -1747,6 +1747,10 @@ fi
if test "$solaris" = "yes" ; then
echo "CONFIG_SOLARIS=y" >> $config_host_mak
fi
+
+if test "$managarm" = "yes" ; then
+ echo "CONFIG_MANAGARM=y" >> $config_host_mak
+fi
echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak

diff --git a/meson.build b/meson.build
index a11018b..ab40bf0 100644
--- a/meson.build
+++ b/meson.build
@@ -2370,6 +2370,7 @@ config_host_data.set('CONFIG_PIXMAN', pixman.found())
config_host_data.set('CONFIG_SLIRP', slirp.found())
config_host_data.set('CONFIG_SNAPPY', snappy.found())
config_host_data.set('CONFIG_SOLARIS', host_os == 'sunos')
+config_host_data.set('CONFIG_MANAGARM', host_os == 'managarm')
if get_option('tcg').allowed()
config_host_data.set('CONFIG_TCG', 1)
config_host_data.set('CONFIG_TCG_INTERPRETER', tcg_arch == 'tci')
--
2.43.0
2.47.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From f8cf4816b6ab27f4ba1f8e932d3a12f9af88eacc Mon Sep 17 00:00:00 2001
From: no92 <[email protected]>
Date: Sun, 3 Nov 2024 22:25:14 +0100
Subject: [PATCH 4/5] smbios: zero-terminate strings read from files

---
hw/smbios/smbios.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index a394514..6b3d015 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1285,6 +1285,9 @@ static int save_opt_one(void *opaque,
g_byte_array_append(data, (guint8 *)buf, ret);
}

+ const guint8 zero = 0;
+ g_byte_array_append(data, &zero, 1);
+
qemu_close(fd);

*opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1);
--
2.47.0

32 changes: 32 additions & 0 deletions patches/qemu/0005-smbios-remove-unnecessary-snprintf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 60c4f5d4716e9048111772cea0e62e7edb655748 Mon Sep 17 00:00:00 2001
From: no92 <[email protected]>
Date: Sun, 3 Nov 2024 22:25:49 +0100
Subject: [PATCH 5/5] smbios: remove unnecessary snprintf

---
hw/smbios/smbios.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 6b3d015..1609e1a 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -814,7 +814,6 @@ static void smbios_build_type_9_table(Error **errp)

static void smbios_build_type_11_table(void)
{
- char count_str[128];
size_t i;

if (type11.nvalues == 0) {
@@ -823,7 +822,6 @@ static void smbios_build_type_11_table(void)

SMBIOS_BUILD_TABLE_PRE(11, T11_BASE, true); /* required */

- snprintf(count_str, sizeof(count_str), "%zu", type11.nvalues);
t->count = type11.nvalues;

for (i = 0; i < type11.nvalues; i++) {
--
2.47.0

0 comments on commit 09ff8f0

Please sign in to comment.