Bard, ports@, I'd like to update qemu to 11.1.1 and backport a patch which allows me to run OpenBSD/macppc in mac99 machine. To boot from FAT volume it needs a few patches to OpenBIOS as well: https://github.com/catap/openbios/commit/e61a69213260e7eae8bef4a8ef0ce5c0b0f6be8a.patch https://github.com/catap/openbios/commit/d14f3c85b567048f0c756b7b030427245416e23d.patch https://github.com/catap/openbios/commit/c05a3d608e452276045e7ec8804a235f8e710e5f.patch https://github.com/catap/openbios/commit/06bd9d43e0755027cad82ba165cb3d2fdd3137a9.patch https://github.com/catap/openbios/commit/d8d459af79ae177dd167be3909ef6f0fab91a563.patch https://github.com/catap/openbios/commit/ba2f9b93d4a157f6d29df606ec4abf6f605e7187.patch which was sent to upstream and can be downloaded as prebuilt elf here: https://github.com/catap/obsd.sh/raw/faed05a1364c0b0b96d97afa51846ac78ac4150f/openbios-ppc-obsd-ba2f9b9.elf The machine and update was tested by building gcc for days, quite stable. The patch includes tests to match everything that was send to upstream. Ok? Index: Makefile =================================================================== RCS file: /home/cvs/ports/emulators/qemu/Makefile,v diff -u -p -r1.265 Makefile --- Makefile 20 Aug 2026 08:46:20 -0000 1.265 +++ Makefile 27 Aug 2026 19:28:22 -0000 @@ -6,8 +6,7 @@ USE_NOBTCFI= Yes COMMENT-main= multi system emulator COMMENT-ga= QEMU guest agent -VERSION= 11.1.0 -REVISION-main= 0 +VERSION= 11.1.1 DISTNAME= qemu-${VERSION} CATEGORIES= emulators SITES= https://download.qemu.org/ Index: distinfo =================================================================== RCS file: /home/cvs/ports/emulators/qemu/distinfo,v diff -u -p -r1.88 distinfo --- distinfo 13 Aug 2026 20:55:28 -0000 1.88 +++ distinfo 27 Aug 2026 19:29:56 -0000 @@ -1,2 +1,2 @@ -SHA256 (qemu-11.1.0.tar.xz) = buHRph9oISR2snEIwm2l9EncCbYm1C+CeboNwuCPqFg= -SIZE (qemu-11.1.0.tar.xz) = 141831772 +SHA256 (qemu-11.1.1.tar.xz) = B5/7/4pxEbvIkCIQfLq/O7/WFNX8nXzGdZkRlqyhJII= +SIZE (qemu-11.1.1.tar.xz) = 141888716 Index: patches/patch-hw_intc_openpic_c =================================================================== RCS file: patches/patch-hw_intc_openpic_c diff -N patches/patch-hw_intc_openpic_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-hw_intc_openpic_c 27 Aug 2026 15:57:04 -0000 @@ -0,0 +1,33 @@ +https://patchew.org/QEMU/20260827155310.7223-1-kirill@korins.ky/ + +Index: hw/intc/openpic.c +--- hw/intc/openpic.c.orig ++++ hw/intc/openpic.c +@@ -1033,8 +1033,9 @@ static void openpic_cpu_write_internal(void *opaque, h + n_IRQ = IRQ_get_next(opp, &dst->raised); + if (n_IRQ != -1) { + src = &opp->src[n_IRQ]; +- if (s_IRQ == -1 || +- IVPR_PRIORITY(src->ivpr) > dst->servicing.priority) { ++ if (IVPR_PRIORITY(src->ivpr) > dst->ctpr && ++ (s_IRQ == -1 || ++ IVPR_PRIORITY(src->ivpr) > dst->servicing.priority)) { + DPRINTF("Raise OpenPIC INT output cpu %d irq %d", + idx, n_IRQ); + qemu_irq_raise(opp->dst[idx].irqs[OPENPIC_OUTPUT_INT]); +@@ -1070,12 +1071,13 @@ static uint32_t openpic_iack(OpenPICState *opp, IRQDes + } + + src = &opp->src[irq]; +- if (!(src->ivpr & IVPR_ACTIVITY_MASK) || +- !(IVPR_PRIORITY(src->ivpr) > dst->ctpr)) { ++ if (!(src->ivpr & IVPR_ACTIVITY_MASK)) { + error_report("%s: bad raised IRQ %d ctpr %d ivpr 0x%08x", + __func__, irq, dst->ctpr, src->ivpr); + openpic_update_irq(opp, irq); + retval = opp->spve; ++ } else if (IVPR_PRIORITY(src->ivpr) <= dst->ctpr) { ++ return opp->spve; + } else { + /* IRQ enter servicing state */ + IRQ_setbit(&dst->servicing, irq); Index: patches/patch-hw_misc_macio_cuda_c =================================================================== RCS file: patches/patch-hw_misc_macio_cuda_c diff -N patches/patch-hw_misc_macio_cuda_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-hw_misc_macio_cuda_c 27 Aug 2026 15:57:14 -0000 @@ -0,0 +1,37 @@ +https://patchew.org/QEMU/20260827155310.7223-1-kirill@korins.ky/ + +Index: hw/misc/macio/cuda.c +--- hw/misc/macio/cuda.c.orig ++++ hw/misc/macio/cuda.c +@@ -431,11 +431,12 @@ static void cuda_receive_packet_from_host(CUDAState *s + { + uint8_t obuf[ADB_MAX_OUT_LEN + 3]; + int olen; +- olen = adb_request(&s->adb_bus, obuf + 2, data + 1, len - 1); ++ olen = adb_request(&s->adb_bus, obuf + 3, data + 1, len - 1); + if (olen > 0) { + obuf[0] = ADB_PACKET; + obuf[1] = 0x00; +- cuda_send_packet_to_host(s, obuf, olen + 2); ++ obuf[2] = data[1]; ++ cuda_send_packet_to_host(s, obuf, olen + 3); + } else { + /* error */ + obuf[0] = ADB_PACKET; +@@ -534,7 +535,6 @@ static void cuda_realize(DeviceState *dev, Error **err + s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET; + + s->sr_delay_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_set_sr_int, s); +- s->sr_delay_ns = 20 * SCALE_US; + + adb_register_autopoll_callback(adb_bus, cuda_adb_poll, s); + } +@@ -556,6 +556,8 @@ static void cuda_init(Object *obj) + + static const Property cuda_properties[] = { + DEFINE_PROP_UINT64("timebase-frequency", CUDAState, tb_frequency, 0), ++ DEFINE_PROP_UINT64("sr-delay-ns", CUDAState, sr_delay_ns, ++ 20 * SCALE_US), + }; + + static void cuda_class_init(ObjectClass *oc, const void *data) Index: patches/patch-hw_ppc_ppc_c =================================================================== RCS file: patches/patch-hw_ppc_ppc_c diff -N patches/patch-hw_ppc_ppc_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-hw_ppc_ppc_c 27 Aug 2026 15:57:19 -0000 @@ -0,0 +1,13 @@ +https://patchew.org/QEMU/20260827155310.7223-1-kirill@korins.ky/ + +Index: hw/ppc/ppc.c +--- hw/ppc/ppc.c.orig ++++ hw/ppc/ppc.c +@@ -885,6 +885,7 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, int6 + * an edge interrupt, so raise it here too. + */ + if (((flags & PPC_DECR_UNDERFLOW_LEVEL) && signed_value < 0) || ++ ((flags & PPC_DECR_UNDERFLOW_TRIGGERED) && value == 0) || + ((flags & PPC_DECR_UNDERFLOW_TRIGGERED) && signed_value < 0 + && signed_decr >= 0)) { + (*raise_excp)(cpu); Index: patches/patch-meson_build =================================================================== RCS file: /home/cvs/ports/emulators/qemu/patches/patch-meson_build,v diff -u -p -r1.22 patch-meson_build --- patches/patch-meson_build 13 Aug 2026 20:55:28 -0000 1.22 +++ patches/patch-meson_build 27 Aug 2026 19:30:51 -0000 @@ -4,7 +4,7 @@ Index: meson.build --- meson.build.orig +++ meson.build -@@ -2387,7 +2387,7 @@ config_host_data.set('CONFIG_QEMU_FIRMWAREPATH', qemu_ +@@ -2392,7 +2392,7 @@ config_host_data.set('CONFIG_QEMU_FIRMWAREPATH', qemu_ config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix') / get_option('libexecdir')) config_host_data.set_quoted('CONFIG_QEMU_ICONDIR', get_option('prefix') / qemu_icondir) config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') / get_option('localedir')) @@ -13,7 +13,7 @@ Index: meson.build config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir) config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) -@@ -4748,9 +4748,6 @@ if have_rust +@@ -4753,9 +4753,6 @@ if have_rust summary_info += {'bindgen version': bindgen.version()} endif option_cflags = (get_option('debug') ? ['-g'] : []) Index: patches/patch-tests_functional_ppc_meson_build =================================================================== RCS file: patches/patch-tests_functional_ppc_meson_build diff -N patches/patch-tests_functional_ppc_meson_build --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-tests_functional_ppc_meson_build 27 Aug 2026 19:27:53 -0000 @@ -0,0 +1,21 @@ +https://patchew.org/QEMU/20260827155310.7223-1-kirill@korins.ky/ + +Index: tests/functional/ppc/meson.build +--- tests/functional/ppc/meson.build.orig ++++ tests/functional/ppc/meson.build +@@ -2,6 +2,7 @@ + + test_ppc_timeouts = { + '40p' : 240, ++ 'openbsd' : 240, + } + + tests_ppc_system_quick = [ +@@ -15,6 +16,7 @@ tests_ppc_system_thorough = [ + 'bamboo', + 'mac', + 'mpc8544ds', ++ 'openbsd', + 'ppe42', + 'replay', + 'sam460ex', Index: patches/patch-tests_functional_ppc_test_openbsd_py =================================================================== RCS file: patches/patch-tests_functional_ppc_test_openbsd_py diff -N patches/patch-tests_functional_ppc_test_openbsd_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-tests_functional_ppc_test_openbsd_py 27 Aug 2026 19:28:02 -0000 @@ -0,0 +1,52 @@ +https://patchew.org/QEMU/20260827155310.7223-1-kirill@korins.ky/ + +Index: tests/functional/ppc/test_openbsd.py +--- tests/functional/ppc/test_openbsd.py.orig ++++ tests/functional/ppc/test_openbsd.py +@@ -0,0 +1,46 @@ ++#!/usr/bin/env python3 ++# ++# Test that OpenBSD boots on mac99 and reaches the installer. ++# ++# SPDX-License-Identifier: GPL-2.0-or-later ++ ++from qemu_test import QemuSystemTest, Asset ++from qemu_test import wait_for_console_pattern ++ ++ ++class OpenBSDMac99(QemuSystemTest): ++ ++ ASSET_CD = Asset( ++ 'https://ftp.eu.openbsd.org/pub/OpenBSD/7.9/macppc/cd79.iso', ++ '227fef3d5089d56ce8376d8bfa28181ce5b19f0eceef0a6d82d58d8e52832b24') ++ ++ def test_openbsd_79_installer(self): ++ self.set_machine('mac99') ++ self.require_accelerator('tcg') ++ cdrom_path = self.ASSET_CD.fetch() ++ ++ self.vm.set_console() ++ self.vm.add_args('-M', 'via=cuda,graphics=off,usb=off', ++ '-cpu', '7400', ++ '-accel', 'tcg,thread=single', ++ '-smp', '1', ++ '-m', '2g', ++ '-nic', 'none', ++ '-device', 'VGA', ++ '-global', 'cuda.sr-delay-ns=0', ++ '-prom-env', 'input-device=ttya', ++ '-prom-env', 'output-device=ttya', ++ '-cdrom', cdrom_path, ++ '-boot', 'd', ++ '-no-reboot') ++ self.vm.launch() ++ ++ wait_for_console_pattern(self, 'OpenBSD 7.9 (RAMDISK)', 'panic:') ++ wait_for_console_pattern( ++ self, ++ '(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?', ++ 'panic:') ++ ++ ++if __name__ == '__main__': ++ QemuSystemTest.main() -- wbr, Kirill
No comments:
Post a Comment