pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Copy over qemu port to wip/qemu-guest-agent



Module Name:	pkgsrc-wip
Committed By:	Benny Siegert <bsiegert%gmail.com@localhost>
Pushed By:	bsiegert
Date:		Tue Apr 9 20:18:23 2024 +0200
Changeset:	3d8eb2ab665e8d97869dac0d9575f59b6165c014

Added Files:
	qemu-guest-agent/DESCR
	qemu-guest-agent/Makefile
	qemu-guest-agent/PLIST
	qemu-guest-agent/distinfo
	qemu-guest-agent/files/Makefile.multinode-NetBSD
	qemu-guest-agent/files/README.NetBSD
	qemu-guest-agent/files/hw-mips-mipssim_virtio.c
	qemu-guest-agent/files/linux-user-test.h
	qemu-guest-agent/options.mk
	qemu-guest-agent/patches/patch-audio_jackaudio.c
	qemu-guest-agent/patches/patch-hw-mips-Kconfig
	qemu-guest-agent/patches/patch-hw-mips-mipssim.c
	qemu-guest-agent/patches/patch-hw_display_omap__dss.c
	qemu-guest-agent/patches/patch-hw_mips_meson.build
	qemu-guest-agent/patches/patch-hw_net_etraxfs__eth.c
	qemu-guest-agent/patches/patch-hw_net_xilinx__axienet.c
	qemu-guest-agent/patches/patch-hw_rtc_mc146818rtc.c
	qemu-guest-agent/patches/patch-hw_scsi_scsi-disk.c
	qemu-guest-agent/patches/patch-hw_usb_dev-mtp.c
	qemu-guest-agent/patches/patch-meson.build
	qemu-guest-agent/patches/patch-roms_u-boot-sam460ex_Makefile
	qemu-guest-agent/patches/patch-target_arm_tcg_translate-sve.c
	qemu-guest-agent/patches/patch-target_i386_cpu.c
	qemu-guest-agent/patches/patch-target_i386_meson.build
	qemu-guest-agent/patches/patch-target_i386_nvmm_nvmm-all.c
	qemu-guest-agent/patches/patch-util_coroutine-ucontext.c
	qemu-guest-agent/patches/patch-util_osdep.c

Log Message:
Copy over qemu port to wip/qemu-guest-agent

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3d8eb2ab665e8d97869dac0d9575f59b6165c014

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 qemu-guest-agent/DESCR                             |  11 +
 qemu-guest-agent/Makefile                          | 224 ++++++++++
 qemu-guest-agent/PLIST                             | 469 +++++++++++++++++++++
 qemu-guest-agent/distinfo                          |  26 ++
 qemu-guest-agent/files/Makefile.multinode-NetBSD   |  59 +++
 qemu-guest-agent/files/README.NetBSD               |  19 +
 qemu-guest-agent/files/hw-mips-mipssim_virtio.c    | 113 +++++
 qemu-guest-agent/files/linux-user-test.h           |   7 +
 qemu-guest-agent/options.mk                        | 103 +++++
 qemu-guest-agent/patches/patch-audio_jackaudio.c   |  20 +
 qemu-guest-agent/patches/patch-hw-mips-Kconfig     |  13 +
 qemu-guest-agent/patches/patch-hw-mips-mipssim.c   |  75 ++++
 .../patches/patch-hw_display_omap__dss.c           |  30 ++
 qemu-guest-agent/patches/patch-hw_mips_meson.build |  13 +
 .../patches/patch-hw_net_etraxfs__eth.c            |  25 ++
 .../patches/patch-hw_net_xilinx__axienet.c         |  16 +
 .../patches/patch-hw_rtc_mc146818rtc.c             |  32 ++
 qemu-guest-agent/patches/patch-hw_scsi_scsi-disk.c |  50 +++
 qemu-guest-agent/patches/patch-hw_usb_dev-mtp.c    |  25 ++
 qemu-guest-agent/patches/patch-meson.build         |  26 ++
 .../patches/patch-roms_u-boot-sam460ex_Makefile    |  32 ++
 .../patches/patch-target_arm_tcg_translate-sve.c   |  16 +
 qemu-guest-agent/patches/patch-target_i386_cpu.c   |  33 ++
 .../patches/patch-target_i386_meson.build          |  14 +
 .../patches/patch-target_i386_nvmm_nvmm-all.c      |  22 +
 .../patches/patch-util_coroutine-ucontext.c        |  19 +
 qemu-guest-agent/patches/patch-util_osdep.c        |  18 +
 27 files changed, 1510 insertions(+)

diffs:
diff --git a/qemu-guest-agent/DESCR b/qemu-guest-agent/DESCR
new file mode 100644
index 0000000000..d939711a26
--- /dev/null
+++ b/qemu-guest-agent/DESCR
@@ -0,0 +1,11 @@
+QEMU is a FAST! processor emulator using dynamic translation to achieve
+good emulation speed, QEMU has two operating modes:
+
+    * Full system emulation. In this mode, QEMU emulates a full system
+      (for example a PC), including a processor and various peripherals.
+      It can be used to launch different Operating Systems without rebooting
+      the PC or to debug system code.
+    * User mode emulation (Linux host only). In this mode, QEMU can launch
+      Linux processes compiled for one CPU on another CPU. It can be used
+      to launch the Wine Windows API emulator or to ease cross-compilation
+      and cross-debugging.
diff --git a/qemu-guest-agent/Makefile b/qemu-guest-agent/Makefile
new file mode 100644
index 0000000000..6b56ec37d8
--- /dev/null
+++ b/qemu-guest-agent/Makefile
@@ -0,0 +1,224 @@
+# $NetBSD: Makefile,v 1.340 2024/04/07 07:33:58 wiz Exp $
+
+DISTNAME=	qemu-8.2.2
+PKGREVISION=	2
+CATEGORIES=	emulators
+MASTER_SITES=	https://download.qemu.org/
+EXTRACT_SUFX=	.tar.xz
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://www.qemu.org/
+COMMENT=	CPU emulator using dynamic translation
+LICENSE=	gnu-gpl-v2 AND gnu-lgpl-v2.1 AND mit AND modified-bsd
+
+TOOL_DEPENDS+=	meson-[0-9]*:../../devel/meson
+TOOL_DEPENDS+=	ninja-build-[0-9]*:../../devel/ninja-build
+TOOL_DEPENDS+=	${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
+TOOL_DEPENDS+=	${PYPKGPREFIX}-sphinx-rtd-theme>=1.2.0:../../textproc/py-sphinx-rtd-theme
+
+USE_CURSES=		resize_term wide
+USE_LANGUAGES+=		c c++
+USE_TOOLS+=		bison flex makeinfo perl:build pod2man pkg-config
+UNLIMIT_RESOURCES=	datasize
+HAS_CONFIGURE=		yes
+
+# https://github.com/qemu/qemu/commit/56208a0d473c6db263cc333c787ca48b502d72ab
+GCC_REQD+=		7
+
+PYTHON_VERSIONS_INCOMPATIBLE=	27
+
+.include "options.mk"
+
+.include "../../mk/bsd.prefs.mk"
+
+# When upgrading Qemu, you need to determine if this PALcode binary for
+# the Alpha emulator needs to be re-built.  If it does not, then you do
+# not need to bump the version of this PALcode binary blob (which is
+# supplied as a separate distfile).  Contact thorpej@ for details.
+PALCODE_CLIPPER=	palcode-clipper-qemu-5.2.0nb8
+
+DISTFILES=		${DEFAULT_DISTFILES}
+DISTFILES+=		${PALCODE_CLIPPER}
+SITES.${PALCODE_CLIPPER}= http://ftp.NetBSD.org/pub/NetBSD/arch/alpha/qemu/
+
+CONFIGURE_ARGS+=	--prefix=${PREFIX}
+CONFIGURE_ARGS+=	--interp-prefix=${PREFIX}/share/qemu
+CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
+CONFIGURE_ARGS+=	--python=${PYTHONBIN}
+CONFIGURE_ARGS+=	--smbd=${PREFIX}/sbin/smbd
+CONFIGURE_ARGS+=	--mandir=${PREFIX}/${PKGMANDIR}
+CONFIGURE_ARGS+=	--enable-curses
+CONFIGURE_ARGS+=	--enable-docs
+CONFIGURE_ENV+=		mansuffix=/${PKGMANDIR}
+ALL_ENV+=		MESON_RSP_THRESHOLD=262144
+
+.if defined(PKGSRC_USE_SSP)
+# do not add flags to everything
+PKGSRC_USE_SSP=		no
+CONFIGURE_ARGS+=	--enable-stack-protector
+.endif
+
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-aarch64
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-alpha
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-arm
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-cris
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-hppa
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-i386
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-m68k
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-microblaze
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-microblazeel
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mips
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mips64
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mips64el
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mipsel
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-nios2
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-or1k
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-ppc
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-ppc64
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-riscv32
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-riscv64
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-s390x
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sh4
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sh4eb
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sparc
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sparc64
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-tricore
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-x86_64
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-xtensa
+NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-xtensaeb
+
+PKG_SYSCONFSUBDIR=	qemu
+
+INSTALLATION_DIRS=	${PKGMANDIR}/man1 share/doc/qemu
+
+.include "../../mk/oss.buildlink3.mk"
+
+.if ${OSS_TYPE} != "none"
+SUBST_CLASSES+=		oss
+SUBST_STAGE.oss=	pre-configure
+SUBST_MESSAGE.oss=	Correcting the path to the OSS device.
+SUBST_FILES.oss+=	audio/ossaudio.c
+SUBST_SED.oss+=		-e "s,/dev/dsp,${DEVOSSAUDIO},g"
+.endif
+
+UE_ARCHS+=		aarch64 aarch64_be
+UE_ARCHS+=		alpha arm armeb cris
+UE_ARCHS+=		hexagon hppa
+UE_ARCHS+=		i386
+UE_ARCHS+=		loongarch64
+UE_ARCHS+=		m68k microblaze microblazeel
+UE_ARCHS+=		mips mips64 mips64el mipsel mipsn32 mipsn32el
+UE_ARCHS+=		nios2
+UE_ARCHS+=		or1k ppc ppc64 ppc64le
+UE_ARCHS+=		riscv32 riscv64
+UE_ARCHS+=		s390x sh4 sh4eb sparc sparc32plus sparc64
+UE_ARCHS+=		x86_64 xtensa xtensaeb
+
+.if ${OPSYS} == "NetBSD"
+PLIST.ga=			yes
+PLIST.nbd=			yes
+.  if !exists(/usr/include/machine/trap.h)	\
+	|| "1"=="1"	# XXX usermode emulation is broken
+CONFIGURE_ARGS+=		--disable-bsd-user
+.  else
+CONFIGURE_ARGS+=		--enable-bsd-user
+USER_EMUL=			i386 x86_64
+.  endif
+.elif ${OPSYS:M*BSD} || ${OPSYS} == "DragonFly"
+USER_EMUL=			i386 x86_64
+PLIST.ga=			yes
+PLIST.nbd=			yes
+.elif ${OPSYS} == "Darwin"
+USER_EMUL=
+CONFIGURE_ARGS+=		--disable-bsd-user
+PLIST.nbd=			yes
+.elif ${OPSYS} == "Linux"
+# Help this package to build on systems too old for user-mode code.
+HAVE_LINUX_USER!=	${CPP} ${CPPFLAGS} ${FILESDIR}/linux-user-test.h \
+  >/dev/null 2>&1 && echo yes || echo no
+.  if ${HAVE_LINUX_USER} != "yes"
+CONFIGURE_ARGS+=		--disable-linux-user
+.  else
+USER_EMUL=			${UE_ARCHS}
+.  endif
+PLIST.bridge-helper=		yes
+PLIST.ga=			yes
+PLIST.nbd=			yes
+PLIST.pr-helper=		yes
+.elif ${MACHINE_PLATFORM:MSunOS-5.11-*}
+PLIST.ga=			yes
+PLIST.nbd=			yes
+CONFIGURE_ARGS+=		--disable-coroutine-pool
+.endif
+
+PLIST_VARS+=		plugins
+.if ${OPSYS} != "SunOS"
+PLIST.plugins=		yes
+CONFIGURE_ARGS+=	--enable-plugins
+.else
+CONFIGURE_ARGS+=	--disable-plugins
+.endif
+
+PLIST_VARS+=		${UE_ARCHS} bridge-helper ga keymap nbd pr-helper
+.for pvar in ${USER_EMUL}
+PLIST.${pvar}=		yes
+.endfor
+
+# different versions of Sphinx generate different static files
+PLIST_SRC=	PLIST ${WRKDIR}/PLIST.STATIC
+
+PRINT_PLIST_AWK+=	/\/_static\// { next; }
+
+TEST_TARGET=		check
+
+PYTHON_FOR_BUILD_ONLY=	tool
+
+post-extract:
+	cp ${WRKDIR}/${PALCODE_CLIPPER} ${WRKSRC}/pc-bios/palcode-clipper
+	cp ${FILESDIR}/hw-mips-mipssim_virtio.c ${WRKSRC}/hw/mips/mipssim_virtio.c
+
+do-build:
+	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+		ninja -j ${_MAKE_JOBS_N:U1} -C build
+
+do-install:
+	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
+		ninja -j ${_MAKE_JOBS_N:U1} -C build install
+
+# Some dependencies aren't correct and this tries to be re-made on install,
+# failing due to configure bugs.
+post-build:
+	${TOUCH} ${WRKSRC}/config-host.mak
+
+post-install:
+	${INSTALL_DATA} ${FILESDIR}/Makefile.multinode-NetBSD \
+		${DESTDIR}${PREFIX}/share/doc/qemu/
+	${INSTALL_DATA} ${FILESDIR}/README.NetBSD \
+		${DESTDIR}${PREFIX}/share/doc/qemu/
+	${RM} -f ${DESTDIR}${PREFIX}/share/doc/qemu/interop/.buildinfo
+	${RM} -f ${DESTDIR}${PREFIX}/share/doc/qemu/specs/.buildinfo
+	${RM} -f ${WRKDIR}/PLIST.STATIC
+	cd ${DESTDIR}${PREFIX} && \
+	${FIND} share/doc/qemu -path '*/_static/*' -type f -print > ${WRKDIR}/PLIST.STATIC
+
+.include "../../archivers/lzo/buildlink3.mk"
+.include "../../archivers/zstd/buildlink3.mk"
+.include "../../devel/glib2/buildlink3.mk"
+.include "../../devel/libusb1/buildlink3.mk"
+.include "../../devel/snappy/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../lang/python/tool.mk"
+.include "../../net/libslirp/buildlink3.mk"
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../sysutils/dtc/buildlink3.mk"
+.include "../../www/curl/buildlink3.mk"
+.include "../../x11/pixman/buildlink3.mk"
+.if ${OPSYS} != "Darwin"
+.include "../../x11/xkeyboard-config/buildlink3.mk"
+.endif
+.include "../../mk/curses.buildlink3.mk"
+.include "../../mk/jpeg.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/qemu-guest-agent/PLIST b/qemu-guest-agent/PLIST
new file mode 100644
index 0000000000..383cf25e6a
--- /dev/null
+++ b/qemu-guest-agent/PLIST
@@ -0,0 +1,469 @@
+@comment $NetBSD: PLIST,v 1.88 2023/12/28 17:15:39 adam Exp $
+bin/elf2dmp
+${PLIST.aarch64}bin/qemu-aarch64
+${PLIST.aarch64_be}bin/qemu-aarch64_be
+${PLIST.alpha}bin/qemu-alpha
+${PLIST.arm}bin/qemu-arm
+${PLIST.armeb}bin/qemu-armeb
+${PLIST.cris}bin/qemu-cris
+bin/qemu-edid
+${PLIST.ga}bin/qemu-ga
+${PLIST.hexagon}bin/qemu-hexagon
+${PLIST.hppa}bin/qemu-hppa
+${PLIST.i386}bin/qemu-i386
+bin/qemu-img
+bin/qemu-io
+${PLIST.keymap}bin/qemu-keymap
+${PLIST.loongarch64}bin/qemu-loongarch64
+${PLIST.m68k}bin/qemu-m68k
+${PLIST.microblaze}bin/qemu-microblaze
+${PLIST.microblazeel}bin/qemu-microblazeel
+${PLIST.mips}bin/qemu-mips
+${PLIST.mips64}bin/qemu-mips64
+${PLIST.mips64el}bin/qemu-mips64el
+${PLIST.mipsel}bin/qemu-mipsel
+${PLIST.mipsn32}bin/qemu-mipsn32
+${PLIST.mipsn32el}bin/qemu-mipsn32el
+${PLIST.nbd}bin/qemu-nbd
+${PLIST.nios2}bin/qemu-nios2
+${PLIST.or1k}bin/qemu-or1k
+${PLIST.ppc}bin/qemu-ppc
+${PLIST.ppc64}bin/qemu-ppc64
+${PLIST.ppc64le}bin/qemu-ppc64le
+${PLIST.pr-helper}bin/qemu-pr-helper
+${PLIST.riscv32}bin/qemu-riscv32
+${PLIST.riscv64}bin/qemu-riscv64
+${PLIST.s390x}bin/qemu-s390x
+${PLIST.sh4}bin/qemu-sh4
+${PLIST.sh4eb}bin/qemu-sh4eb
+${PLIST.sparc}bin/qemu-sparc
+${PLIST.sparc32plus}bin/qemu-sparc32plus
+${PLIST.sparc64}bin/qemu-sparc64
+bin/qemu-storage-daemon
+bin/qemu-system-aarch64
+bin/qemu-system-alpha
+bin/qemu-system-arm
+bin/qemu-system-avr
+bin/qemu-system-cris
+bin/qemu-system-hppa
+bin/qemu-system-i386
+bin/qemu-system-loongarch64
+bin/qemu-system-m68k
+bin/qemu-system-microblaze
+bin/qemu-system-microblazeel
+bin/qemu-system-mips
+bin/qemu-system-mips64
+bin/qemu-system-mips64el
+bin/qemu-system-mipsel
+bin/qemu-system-nios2
+bin/qemu-system-or1k
+bin/qemu-system-ppc
+bin/qemu-system-ppc64
+bin/qemu-system-riscv32
+bin/qemu-system-riscv64
+bin/qemu-system-rx
+bin/qemu-system-s390x
+bin/qemu-system-sh4
+bin/qemu-system-sh4eb
+bin/qemu-system-sparc
+bin/qemu-system-sparc64
+bin/qemu-system-tricore
+bin/qemu-system-x86_64
+bin/qemu-system-xtensa
+bin/qemu-system-xtensaeb
+${PLIST.x86_64}bin/qemu-x86_64
+${PLIST.xtensa}bin/qemu-xtensa
+${PLIST.xtensaeb}bin/qemu-xtensaeb
+${PLIST.plugins}include/qemu-plugin.h
+${PLIST.bridge-helper}libexec/qemu-bridge-helper
+${PLIST.virtfs-proxy-helper}libexec/virtfs-proxy-helper
+man/man1/qemu-img.1
+man/man1/qemu-storage-daemon.1
+man/man1/qemu.1
+${PLIST.virtfs-proxy-helper}man/man1/virtfs-proxy-helper.1
+man/man7/qemu-block-drivers.7
+man/man7/qemu-cpu-models.7
+${PLIST.ga}man/man7/qemu-ga-ref.7
+man/man7/qemu-qmp-ref.7
+man/man7/qemu-storage-daemon-qmp-ref.7
+${PLIST.ga}man/man8/qemu-ga.8
+man/man8/qemu-nbd.8
+man/man8/qemu-pr-helper.8
+share/applications/qemu.desktop
+share/doc/qemu/.buildinfo
+share/doc/qemu/Makefile.multinode-NetBSD
+share/doc/qemu/README.NetBSD
+share/doc/qemu/about/build-platforms.html
+share/doc/qemu/about/deprecated.html
+share/doc/qemu/about/emulation.html
+share/doc/qemu/about/index.html
+share/doc/qemu/about/license.html
+share/doc/qemu/about/removed-features.html
+share/doc/qemu/dbus-dbusindex.html
+share/doc/qemu/devel/acpi-bits.html
+share/doc/qemu/devel/atomics.html
+share/doc/qemu/devel/bitops.html
+share/doc/qemu/devel/block-coroutine-wrapper.html
+share/doc/qemu/devel/build-system.html
+share/doc/qemu/devel/ci.html
+share/doc/qemu/devel/clocks.html
+share/doc/qemu/devel/code-of-conduct.html
+share/doc/qemu/devel/conflict-resolution.html
+share/doc/qemu/devel/control-flow-integrity.html
+share/doc/qemu/devel/decodetree.html
+share/doc/qemu/devel/ebpf_rss.html
+share/doc/qemu/devel/fuzzing.html
+share/doc/qemu/devel/index-api.html
+share/doc/qemu/devel/index-build.html
+share/doc/qemu/devel/index-internals.html
+share/doc/qemu/devel/index-process.html
+share/doc/qemu/devel/index-tcg.html
+share/doc/qemu/devel/index.html
+share/doc/qemu/devel/kconfig.html
+share/doc/qemu/devel/loads-stores.html
+share/doc/qemu/devel/maintainers.html
+share/doc/qemu/devel/memory.html
+share/doc/qemu/devel/migration.html
+share/doc/qemu/devel/modules.html
+share/doc/qemu/devel/multi-process.html
+share/doc/qemu/devel/multi-thread-tcg.html
+share/doc/qemu/devel/pci.html
+share/doc/qemu/devel/qapi-code-gen.html
+share/doc/qemu/devel/qdev-api.html
+share/doc/qemu/devel/qgraph.html
+share/doc/qemu/devel/qom-api.html
+share/doc/qemu/devel/qom.html
+share/doc/qemu/devel/qtest.html
+share/doc/qemu/devel/replay.html
+share/doc/qemu/devel/reset.html
+share/doc/qemu/devel/s390-cpu-topology.html
+share/doc/qemu/devel/s390-dasd-ipl.html
+share/doc/qemu/devel/secure-coding-practices.html
+share/doc/qemu/devel/stable-process.html
+share/doc/qemu/devel/style.html
+share/doc/qemu/devel/submitting-a-patch.html
+share/doc/qemu/devel/submitting-a-pull-request.html
+share/doc/qemu/devel/tcg-icount.html
+share/doc/qemu/devel/tcg-ops.html
+share/doc/qemu/devel/tcg-plugins.html
+share/doc/qemu/devel/tcg.html
+share/doc/qemu/devel/testing.html
+share/doc/qemu/devel/tracing.html
+share/doc/qemu/devel/trivial-patches.html
+share/doc/qemu/devel/ui.html
+share/doc/qemu/devel/vfio-migration.html
+share/doc/qemu/devel/virtio-backends.html
+share/doc/qemu/devel/writing-monitor-commands.html
+share/doc/qemu/devel/zoned-storage.html
+share/doc/qemu/genindex.html
+share/doc/qemu/index.html
+share/doc/qemu/interop/barrier.html
+share/doc/qemu/interop/bitmaps.html
+share/doc/qemu/interop/dbus-display.html
+share/doc/qemu/interop/dbus-vmstate.html
+share/doc/qemu/interop/dbus.html
+share/doc/qemu/interop/index.html
+share/doc/qemu/interop/live-block-operations.html
+share/doc/qemu/interop/pr-helper.html
+share/doc/qemu/interop/qemu-ga-ref.html
+share/doc/qemu/interop/qemu-ga.html
+share/doc/qemu/interop/qemu-qmp-ref.html
+share/doc/qemu/interop/qemu-storage-daemon-qmp-ref.html
+share/doc/qemu/interop/qmp-spec.html
+share/doc/qemu/interop/vhost-user-gpu.html
+share/doc/qemu/interop/vhost-user.html
+share/doc/qemu/interop/vhost-vdpa.html
+share/doc/qemu/interop/virtio-balloon-stats.html
+share/doc/qemu/interop/vnc-ledstate-pseudo-encoding.html
+share/doc/qemu/objects.inv
+share/doc/qemu/search.html
+share/doc/qemu/searchindex.js
+share/doc/qemu/specs/acpi_cpu_hotplug.html
+share/doc/qemu/specs/acpi_erst.html
+share/doc/qemu/specs/acpi_hest_ghes.html
+share/doc/qemu/specs/acpi_hw_reduced_hotplug.html
+share/doc/qemu/specs/acpi_mem_hotplug.html
+share/doc/qemu/specs/acpi_nvdimm.html
+share/doc/qemu/specs/acpi_pci_hotplug.html
+share/doc/qemu/specs/edu.html
+share/doc/qemu/specs/fw_cfg.html
+share/doc/qemu/specs/index.html
+share/doc/qemu/specs/ivshmem-spec.html
+share/doc/qemu/specs/pci-ids.html
+share/doc/qemu/specs/pci-serial.html
+share/doc/qemu/specs/pci-testdev.html
+share/doc/qemu/specs/ppc-spapr-hcalls.html
+share/doc/qemu/specs/ppc-spapr-hotplug.html
+share/doc/qemu/specs/ppc-spapr-numa.html
+share/doc/qemu/specs/ppc-spapr-uv-hcalls.html
+share/doc/qemu/specs/ppc-spapr-xive.html
+share/doc/qemu/specs/ppc-xive.html
+share/doc/qemu/specs/pvpanic.html
+share/doc/qemu/specs/sev-guest-firmware.html
+share/doc/qemu/specs/standard-vga.html
+share/doc/qemu/specs/tpm.html
+share/doc/qemu/specs/virt-ctlr.html
+share/doc/qemu/specs/vmcoreinfo.html
+share/doc/qemu/specs/vmgenid.html
+share/doc/qemu/specs/vmw_pvscsi-spec.html
+share/doc/qemu/system/arm/aspeed.html
+share/doc/qemu/system/arm/bananapi_m2u.html
+share/doc/qemu/system/arm/collie.html
+share/doc/qemu/system/arm/cpu-features.html
+share/doc/qemu/system/arm/cubieboard.html
+share/doc/qemu/system/arm/digic.html
+share/doc/qemu/system/arm/emcraft-sf2.html
+share/doc/qemu/system/arm/emulation.html
+share/doc/qemu/system/arm/gumstix.html
+share/doc/qemu/system/arm/highbank.html
+share/doc/qemu/system/arm/imx25-pdk.html
+share/doc/qemu/system/arm/integratorcp.html
+share/doc/qemu/system/arm/kzm.html
+share/doc/qemu/system/arm/mainstone.html
+share/doc/qemu/system/arm/mps2.html
+share/doc/qemu/system/arm/musca.html
+share/doc/qemu/system/arm/musicpal.html
+share/doc/qemu/system/arm/nrf.html
+share/doc/qemu/system/arm/nseries.html
+share/doc/qemu/system/arm/nuvoton.html
+share/doc/qemu/system/arm/orangepi.html
+share/doc/qemu/system/arm/palm.html
+share/doc/qemu/system/arm/raspi.html
+share/doc/qemu/system/arm/realview.html
+share/doc/qemu/system/arm/sabrelite.html
+share/doc/qemu/system/arm/sbsa.html
+share/doc/qemu/system/arm/stellaris.html
+share/doc/qemu/system/arm/stm32.html
+share/doc/qemu/system/arm/sx1.html
+share/doc/qemu/system/arm/versatile.html
+share/doc/qemu/system/arm/vexpress.html
+share/doc/qemu/system/arm/virt.html
+share/doc/qemu/system/arm/xenpvh.html
+share/doc/qemu/system/arm/xlnx-versal-virt.html
+share/doc/qemu/system/arm/xscale.html
+share/doc/qemu/system/authz.html
+share/doc/qemu/system/barrier.html
+share/doc/qemu/system/bootindex.html
+share/doc/qemu/system/confidential-guest-support.html
+share/doc/qemu/system/cpu-hotplug.html
+share/doc/qemu/system/device-emulation.html
+share/doc/qemu/system/devices/can.html
+share/doc/qemu/system/devices/canokey.html
+share/doc/qemu/system/devices/ccid.html
+share/doc/qemu/system/devices/cxl.html
+share/doc/qemu/system/devices/igb.html
+share/doc/qemu/system/devices/ivshmem.html
+share/doc/qemu/system/devices/keyboard.html
+share/doc/qemu/system/devices/net.html
+share/doc/qemu/system/devices/nvme.html
+share/doc/qemu/system/devices/usb-u2f.html
+share/doc/qemu/system/devices/usb.html
+share/doc/qemu/system/devices/vhost-user-rng.html
+share/doc/qemu/system/devices/vhost-user.html
+share/doc/qemu/system/devices/virtio-gpu.html
+share/doc/qemu/system/devices/virtio-pmem.html
+share/doc/qemu/system/devices/virtio-snd.html
+share/doc/qemu/system/gdb.html
+share/doc/qemu/system/generic-loader.html
+share/doc/qemu/system/guest-loader.html
+share/doc/qemu/system/i386/amd-memory-encryption.html
+share/doc/qemu/system/i386/cpu.html
+share/doc/qemu/system/i386/hyperv.html
+share/doc/qemu/system/i386/kvm-pv.html
+share/doc/qemu/system/i386/microvm.html
+share/doc/qemu/system/i386/pc.html
+share/doc/qemu/system/i386/sgx.html
+share/doc/qemu/system/i386/xen.html
+share/doc/qemu/system/images.html
+share/doc/qemu/system/index.html
+share/doc/qemu/system/introduction.html
+share/doc/qemu/system/invocation.html
+share/doc/qemu/system/keys.html
+share/doc/qemu/system/linuxboot.html
+share/doc/qemu/system/loongarch/virt.html
+share/doc/qemu/system/managed-startup.html
+share/doc/qemu/system/monitor.html
+share/doc/qemu/system/multi-process.html
+share/doc/qemu/system/mux-chardev.html
+share/doc/qemu/system/openrisc/cpu-features.html
+share/doc/qemu/system/openrisc/emulation.html
+share/doc/qemu/system/openrisc/or1k-sim.html
+share/doc/qemu/system/openrisc/virt.html
+share/doc/qemu/system/ppc/embedded.html
+share/doc/qemu/system/ppc/powermac.html
+share/doc/qemu/system/ppc/powernv.html
+share/doc/qemu/system/ppc/ppce500.html
+share/doc/qemu/system/ppc/prep.html
+share/doc/qemu/system/ppc/pseries.html
+share/doc/qemu/system/pr-manager.html
+share/doc/qemu/system/qemu-block-drivers.html
+share/doc/qemu/system/qemu-cpu-models.html
+share/doc/qemu/system/qemu-manpage.html
+share/doc/qemu/system/replay.html
+share/doc/qemu/system/riscv/microchip-icicle-kit.html
+share/doc/qemu/system/riscv/shakti-c.html
+share/doc/qemu/system/riscv/sifive_u.html
+share/doc/qemu/system/riscv/virt.html
+share/doc/qemu/system/s390x/3270.html
+share/doc/qemu/system/s390x/bootdevices.html
+share/doc/qemu/system/s390x/cpu-topology.html
+share/doc/qemu/system/s390x/css.html
+share/doc/qemu/system/s390x/pcidevices.html
+share/doc/qemu/system/s390x/protvirt.html
+share/doc/qemu/system/s390x/vfio-ap.html
+share/doc/qemu/system/s390x/vfio-ccw.html
+share/doc/qemu/system/secrets.html
+share/doc/qemu/system/security.html
+share/doc/qemu/system/target-arm.html
+share/doc/qemu/system/target-avr.html
+share/doc/qemu/system/target-i386.html
+share/doc/qemu/system/target-m68k.html
+share/doc/qemu/system/target-mips.html
+share/doc/qemu/system/target-openrisc.html
+share/doc/qemu/system/target-ppc.html
+share/doc/qemu/system/target-riscv.html
+share/doc/qemu/system/target-rx.html
+share/doc/qemu/system/target-s390x.html
+share/doc/qemu/system/target-sparc.html
+share/doc/qemu/system/target-sparc64.html
+share/doc/qemu/system/target-xtensa.html
+share/doc/qemu/system/targets.html
+share/doc/qemu/system/tls.html
+share/doc/qemu/system/virtio-net-failover.html
+share/doc/qemu/system/vm-templating.html
+share/doc/qemu/system/vnc-security.html
+share/doc/qemu/tools/index.html
+share/doc/qemu/tools/qemu-img.html
+share/doc/qemu/tools/qemu-nbd.html
+share/doc/qemu/tools/qemu-pr-helper.html
+share/doc/qemu/tools/qemu-storage-daemon.html
+share/doc/qemu/tools/qemu-trace-stap.html
+share/doc/qemu/tools/virtfs-proxy-helper.html
+share/doc/qemu/user/index.html
+share/doc/qemu/user/main.html
+share/icons/hicolor/128x128/apps/qemu.png
+share/icons/hicolor/16x16/apps/qemu.png
+share/icons/hicolor/24x24/apps/qemu.png
+share/icons/hicolor/256x256/apps/qemu.png
+share/icons/hicolor/32x32/apps/qemu.bmp
+share/icons/hicolor/32x32/apps/qemu.png
+share/icons/hicolor/48x48/apps/qemu.png
+share/icons/hicolor/512x512/apps/qemu.png
+share/icons/hicolor/64x64/apps/qemu.png
+share/icons/hicolor/scalable/apps/qemu.svg
+${PLIST.gtk}share/locale/bg/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/de_DE/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/fr_FR/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/hu/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/it/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/sv/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/tr/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/uk/LC_MESSAGES/qemu.mo
+${PLIST.gtk}share/locale/zh_CN/LC_MESSAGES/qemu.mo
+share/qemu/QEMU,cgthree.bin
+share/qemu/QEMU,tcx.bin
+share/qemu/bamboo.dtb
+share/qemu/bios-256k.bin
+share/qemu/bios-microvm.bin
+share/qemu/bios.bin
+share/qemu/canyonlands.dtb
+share/qemu/edk2-aarch64-code.fd
+share/qemu/edk2-arm-code.fd
+share/qemu/edk2-arm-vars.fd
+share/qemu/edk2-i386-code.fd
+share/qemu/edk2-i386-secure-code.fd
+share/qemu/edk2-i386-vars.fd
+share/qemu/edk2-licenses.txt
+share/qemu/edk2-x86_64-code.fd
+share/qemu/edk2-x86_64-secure-code.fd
+share/qemu/efi-e1000.rom
+share/qemu/efi-e1000e.rom
+share/qemu/efi-eepro100.rom
+share/qemu/efi-ne2k_pci.rom
+share/qemu/efi-pcnet.rom
+share/qemu/efi-rtl8139.rom
+share/qemu/efi-virtio.rom
+share/qemu/efi-vmxnet3.rom
+share/qemu/firmware/50-edk2-i386-secure.json
+share/qemu/firmware/50-edk2-x86_64-secure.json
+share/qemu/firmware/60-edk2-aarch64.json
+share/qemu/firmware/60-edk2-arm.json
+share/qemu/firmware/60-edk2-i386.json
+share/qemu/firmware/60-edk2-x86_64.json
+share/qemu/hppa-firmware.img
+share/qemu/keymaps/ar
+share/qemu/keymaps/bepo
+share/qemu/keymaps/cz
+share/qemu/keymaps/da
+share/qemu/keymaps/de
+share/qemu/keymaps/de-ch
+share/qemu/keymaps/en-gb
+share/qemu/keymaps/en-us
+share/qemu/keymaps/es
+share/qemu/keymaps/et
+share/qemu/keymaps/fi
+share/qemu/keymaps/fo
+share/qemu/keymaps/fr
+share/qemu/keymaps/fr-be
+share/qemu/keymaps/fr-ca
+share/qemu/keymaps/fr-ch
+share/qemu/keymaps/hr
+share/qemu/keymaps/hu
+share/qemu/keymaps/is
+share/qemu/keymaps/it
+share/qemu/keymaps/ja
+share/qemu/keymaps/lt
+share/qemu/keymaps/lv
+share/qemu/keymaps/mk
+share/qemu/keymaps/nl
+share/qemu/keymaps/no
+share/qemu/keymaps/pl
+share/qemu/keymaps/pt
+share/qemu/keymaps/pt-br
+share/qemu/keymaps/ru
+share/qemu/keymaps/sl
+share/qemu/keymaps/sv
+share/qemu/keymaps/th
+share/qemu/keymaps/tr
+share/qemu/kvmvapic.bin
+share/qemu/linuxboot.bin
+share/qemu/linuxboot_dma.bin
+share/qemu/multiboot.bin
+share/qemu/multiboot_dma.bin
+share/qemu/npcm7xx_bootrom.bin
+share/qemu/openbios-ppc
+share/qemu/openbios-sparc32
+share/qemu/openbios-sparc64
+share/qemu/opensbi-riscv32-generic-fw_dynamic.bin
+share/qemu/opensbi-riscv64-generic-fw_dynamic.bin
+share/qemu/palcode-clipper
+share/qemu/petalogix-ml605.dtb
+share/qemu/petalogix-s3adsp1800.dtb
+share/qemu/pvh.bin
+share/qemu/pxe-e1000.rom
+share/qemu/pxe-eepro100.rom
+share/qemu/pxe-ne2k_pci.rom
+share/qemu/pxe-pcnet.rom
+share/qemu/pxe-rtl8139.rom
+share/qemu/pxe-virtio.rom
+share/qemu/qboot.rom
+share/qemu/qemu-nsis.bmp
+share/qemu/qemu_vga.ndrv
+share/qemu/s390-ccw.img
+share/qemu/s390-netboot.img
+share/qemu/skiboot.lid
+share/qemu/slof.bin
+share/qemu/trace-events-all
+share/qemu/u-boot-sam460-20100605.bin
+share/qemu/u-boot.e500
+share/qemu/vgabios-ati.bin
+share/qemu/vgabios-bochs-display.bin
+share/qemu/vgabios-cirrus.bin
+share/qemu/vgabios-qxl.bin
+share/qemu/vgabios-ramfb.bin
+share/qemu/vgabios-stdvga.bin
+share/qemu/vgabios-virtio.bin
+share/qemu/vgabios-vmware.bin
+share/qemu/vgabios.bin
+share/qemu/vof-nvram.bin
+share/qemu/vof.bin
diff --git a/qemu-guest-agent/distinfo b/qemu-guest-agent/distinfo
new file mode 100644
index 0000000000..dda2fbbe56
--- /dev/null
+++ b/qemu-guest-agent/distinfo
@@ -0,0 +1,26 @@
+$NetBSD: distinfo,v 1.216 2024/03/04 18:46:38 adam Exp $
+
+BLAKE2s (palcode-clipper-qemu-5.2.0nb8) = d388c896a80c1cc3d4785c8434d6688bbcfd54c28f7252ce550ab162a0bba321
+SHA512 (palcode-clipper-qemu-5.2.0nb8) = 33695d6001d86a19793a92d5e31775607c4dfc9ab9eea019ea6c4d543a2e11e8c07f83cca4934811a13ef829b528737ea37d9d2aaf66cba6f2746d44d2aa0b43
+Size (palcode-clipper-qemu-5.2.0nb8) = 159808 bytes
+BLAKE2s (qemu-8.2.2.tar.xz) = f24a5b17834a3317580fb7ef6e49c027d4e4e20151cdebb9f88c62cd9e790286
+SHA512 (qemu-8.2.2.tar.xz) = dfd2e1305f9e51bfbc90a7738c69336d5f805481a626ea527b971bdfb6dbe6867e5df7461d48d1c22b79be2dc18e057ea9fa36ef593127cd8b262a5c33f1aa41
+Size (qemu-8.2.2.tar.xz) = 129398020 bytes
+SHA1 (patch-audio_jackaudio.c) = 771c2779e565242a500adc0223ef6b1ae5b2b91f
+SHA1 (patch-hw-mips-Kconfig) = c7199ad26ac45116ab4d38252db4234ae93bdf9a
+SHA1 (patch-hw-mips-mipssim.c) = 1f682b74b34398b3ff15f9e7f24a85f4b8bb4853
+SHA1 (patch-hw_display_omap__dss.c) = 68f6f5e86335114de64b397959a2238de84fcde2
+SHA1 (patch-hw_mips_meson.build) = d9a07a81fe6d3c9e2bd45f41fe876cd927a40ced
+SHA1 (patch-hw_net_etraxfs__eth.c) = e5dd1661d60dbcd27b332403e0843500ba9544bc
+SHA1 (patch-hw_net_xilinx__axienet.c) = ebcd2676d64ce6f31e4a8c976d4fdf530ad5e8b7
+SHA1 (patch-hw_rtc_mc146818rtc.c) = cc7a3b28010966b65b7a16db756226ac2669f310
+SHA1 (patch-hw_scsi_scsi-disk.c) = fdbf2f962a6dcb1a115a7f8a5b8790ff9295fb33
+SHA1 (patch-hw_usb_dev-mtp.c) = 94ddf53a41cc75810cfece1b8aef1831fab4ce43
+SHA1 (patch-meson.build) = 0a3e28d8bf6bf6be311787d964ac4694c58c2fca
+SHA1 (patch-roms_u-boot-sam460ex_Makefile) = 3a1bbf19b1422c10ebdd819eb0b711fafc78e2f2
+SHA1 (patch-target_arm_tcg_translate-sve.c) = b5eeb08331e61a16b2cf4b7ab9b668755aa9a04e
+SHA1 (patch-target_i386_cpu.c) = 696b1137a7aac18f70933025cab5318b965aee66
+SHA1 (patch-target_i386_meson.build) = b8f413866ac1079d3ddeb21aacf226509e25ae9c
+SHA1 (patch-target_i386_nvmm_nvmm-all.c) = 28184cc3d1afc064d332bdd2530db16d8258222f
+SHA1 (patch-util_coroutine-ucontext.c) = 02cdf634e64f7e71029047b93747f192df715e6a
+SHA1 (patch-util_osdep.c) = 1e5bcde7be23792f487334d35797869bff686d25
diff --git a/qemu-guest-agent/files/Makefile.multinode-NetBSD b/qemu-guest-agent/files/Makefile.multinode-NetBSD
new file mode 100644
index 0000000000..f4313832eb
--- /dev/null
+++ b/qemu-guest-agent/files/Makefile.multinode-NetBSD
@@ -0,0 +1,59 @@
+# $Id: Makefile.multinode-NetBSD,v 1.4 2012/06/07 21:23:46 ryoon Exp $
+# Source: http://mail-index.NetBSD.org/netbsd-help/2005/03/25/0005.html
+#
+# Starts up two qemu instances and networks bridges them to the local
+# ethernet (ETHER_IF}.  Works best with NetBSD configured to use serial
+# consoles in DISK[12]
+#
+# Usage:
+#	sudo make netbsd1
+#	sudo make netbsd2
+#
+#  - Hubert Feyrer <hubert%feyrer.de@localhost>
+#
+
+#NETBSD_NOGFX=
+NETBSD_NOGFX=		-nographic
+
+ETHER_IF=	tlp0
+QEMU_RAM=	20
+DISK1=		harddisk.netbsd1
+DISK2=		harddisk.netbsd2
+
+
+all: netbsd1 netbsd2
+
+netbsd1: bridge 
+	ifconfig tap1 create up	     || echo tap1: already there
+	brconfig bridge0 add tap1 up || echo tap1: already on bridge0
+	brconfig bridge0 -learn tap1 # real hub mode, step 1b
+	brconfig bridge0 flush	# real hub more, step 2
+	qemu \	
+		-m ${QEMU_RAM} \
+		${NETBSD_NOGFX} \
+		-boot c \
+		-net tap,fd=3,ifname=tap1 3<>/dev/tap1 \
+		-net nic,macaddr=de:ad:be:ef:00:01 \
+		${DISK1}
+	brconfig bridge0 delete tap1 
+	ifconfig tap1 destroy
+
+netbsd2: bridge
+	ifconfig tap2 create up	     || echo tap2: already there
+	brconfig bridge0 add tap2 up || echo tap2: already on bridge0
+	brconfig bridge0 -learn tap2 # real hub mode, step 1c
+	brconfig bridge0 flush	     # real hub mode, step 2
+	qemu \
+		-m ${QEMU_RAM} \
+		${NETBSD_NOGFX} \
+		-boot c \
+		-net tap,fd=3,ifname=tap2 3<>/dev/tap2 \
+		-net nic,macaddr=de:ad:be:ef:00:02 \
+		${DISK2}
+	brconfig bridge0 delete tap2
+	ifconfig tap2 destroy
+	
+bridge:
+	ifconfig bridge0 create	  || echo bridge0: already there
+	brconfig bridge0 add ${ETHER_IF} || echo bridge0: ${ETHER_IF} already there
+	brconfig bridge0 -learn ${ETHER_IF} # real hub mode, step 1a
diff --git a/qemu-guest-agent/files/README.NetBSD b/qemu-guest-agent/files/README.NetBSD
new file mode 100644
index 0000000000..ba0fee0d44
--- /dev/null
+++ b/qemu-guest-agent/files/README.NetBSD
@@ -0,0 +1,19 @@
+$NetBSD: README.NetBSD,v 1.1 2023/12/07 17:41:55 gdt Exp $
+
+To use the NetBSD/amd64 Virtual Memory Monitor (NVMM) for QEMU :
+
+Load the NVMM kernel driver if not already loaded
+# modload nvmm
+
+You may want to run the NVMM tests to confirm that your setup is correct:
+# cd /usr/tests/lib/libnvmm/
+# atf-run | atf-report
+
+Configure the permissions once either by adding the username(s) of its users
+to the nvmm group in /etc/groups.
+
+Append "-accel nvmm" to your usual Qemu command line
+$ qemu-system-x86_64 -smp 4 -m 8G -cdrom Win10_2004_English_x64.iso -accel nvmm
+
+See nvmm(4) and nvmmctl(8) or visit
+   https://m00nbsd.net/4e0798b7f2620c965d0dd9d6a7a2f296.html for more info.
diff --git a/qemu-guest-agent/files/hw-mips-mipssim_virtio.c b/qemu-guest-agent/files/hw-mips-mipssim_virtio.c
new file mode 100644
index 0000000000..047fea4130
--- /dev/null
+++ b/qemu-guest-agent/files/hw-mips-mipssim_virtio.c
@@ -0,0 +1,113 @@
+/*
+ * QEMU/mipssim-virtio extension emulation
+ *
+ * Emulates a very simple machine model similar to the one used by the
+ * proprietary MIPS emulator extended by a virtio device. The purpose is to
+ * have a better virt platform in anticipation to a readl `virt' platform for
+ * MIPS.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Reinoud Zandijk.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "cpu.h"
+#include "hw/mips/mips.h"
+#include "hw/char/serial.h"
+#include "hw/isa/isa.h"
+#include "net/net.h"
+#include "sysemu/sysemu.h"
+#include "hw/boards.h"
+#include "hw/mips/bios.h"
+#include "hw/loader.h"
+#include "hw/or-irq.h"
+#include "elf.h"
+#include "hw/sysbus.h"
+#include "hw/qdev-properties.h"
+#include "exec/address-spaces.h"
+#include "qemu/error-report.h"
+#include "sysemu/qtest.h"
+#include "sysemu/reset.h"
+#include "hw/virtio/virtio-mmio.h"
+
+#define NUM_VIRTIO_TRANSPORTS   32
+#define VIRTIO_STRIDE           512
+
+#define DEV_SPACING             0x10000		/* space devices every 64k */
+#define ISA_BASE                0x1fd00000
+#define	VIRTIO_MMIO_BASE        (ISA_BASE + DEV_SPACING)
+
+extern void mips_mipssim_init(MachineState *machine);
+
+static void
+mips_mipssim_virtio_init(MachineState *machine)
+{
+    DeviceState *virtio_orgate;
+    MIPSCPU *cpu;
+    CPUMIPSState *env;
+
+    /* initialise parent */
+    mips_mipssim_init(machine);
+
+    cpu = MIPS_CPU(qemu_get_cpu(0));
+    env = &cpu->env;
+
+    /*
+     * TODO: in newer versions, we might need to adjust the cpu clock when its
+     * set in mips_mipssim_init()
+     */
+
+    /*
+     * virtio extention; register 32 virtio devices just after the ISA space
+     * at 0x1fd10000 with stride of 512 bytes as per i386s microvm target.
+     * register these devices in reverse order (see comments in hw/arm/virt.c)
+     */
+    virtio_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+    object_property_set_int(OBJECT(virtio_orgate),
+         "num-lines", NUM_VIRTIO_TRANSPORTS, &error_fatal);
+    qdev_realize_and_unref(virtio_orgate, NULL, &error_fatal);
+
+    for (int i = NUM_VIRTIO_TRANSPORTS - 1; i >= 0; i--) {
+        sysbus_create_simple("virtio-mmio",
+            VIRTIO_MMIO_BASE + i * VIRTIO_STRIDE,
+            qdev_get_gpio_in(virtio_orgate, i));
+    }
+    qdev_connect_gpio_out(DEVICE(virtio_orgate), 0, env->irq[3]);
+}
+
+static void mips_mipssim_virtio_machine_init(MachineClass *mc)
+{
+    mc->desc = "MIPS MIPSsim platform with virtio";
+    mc->init = mips_mipssim_virtio_init;
+#ifdef TARGET_MIPS64
+    mc->default_cpu_type = MIPS_CPU_TYPE_NAME("5Kf");
+#else
+    mc->default_cpu_type = MIPS_CPU_TYPE_NAME("24Kf");
+#endif
+    mc->default_ram_id = "mips_mipssim.ram";
+}
+
+DEFINE_MACHINE("mipssim-virtio", mips_mipssim_virtio_machine_init)
+
diff --git a/qemu-guest-agent/files/linux-user-test.h b/qemu-guest-agent/files/linux-user-test.h
new file mode 100644
index 0000000000..3f9f919b63
--- /dev/null
+++ b/qemu-guest-agent/files/linux-user-test.h
@@ -0,0 +1,7 @@
+/* Qemu 8+ needs MAP_FIXED_NOREPLACE for linux user-mode emulation.
+   They offically do not support systems that are too old (glibc
+   version), but we're trying to build the rest, anyway. */
+#include <sys/mman.h>
+#ifndef MAP_FIXED_NOREPLACE
+#error "Your libc is too old."
+#endif
diff --git a/qemu-guest-agent/options.mk b/qemu-guest-agent/options.mk
new file mode 100644
index 0000000000..15c61df603
--- /dev/null
+++ b/qemu-guest-agent/options.mk
@@ -0,0 +1,103 @@
+# $NetBSD: options.mk,v 1.23 2024/02/20 19:08:39 imil Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.qemu
+PKG_SUPPORTED_OPTIONS=	debug debug-info gtk3 iscsi jack sdl spice
+PKG_SUGGESTED_OPTIONS+=	iscsi sdl spice
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if ${OPSYS} == "Linux"
+PKG_SUPPORTED_OPTIONS+=	virtfs-proxy-helper
+.endif
+
+.if ${OPSYS} != "Darwin"
+# NetBSD<9.0 does not have EGL support in native X11,
+# so the QEMU OpenGL display driver cannot build.
+.  include "../../graphics/MesaLib/features.mk"
+.  if !empty(MESALIB_SUPPORTS_EGL:M[Yy][Ee][Ss])
+PKG_SUPPORTED_OPTIONS+=	opengl
+PKG_SUGGESTED_OPTIONS+=	opengl
+.  endif
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=		gtk keymap virtfs-proxy-helper
+
+.if !empty(PKG_OPTIONS:Mjack)
+CONFIGURE_ARGS+=	--enable-jack
+.include "../../audio/jack/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-jack
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug-info)
+CONFIGURE_ARGS+=	--enable-debug-info
+.else
+CONFIGURE_ARGS+=	--disable-debug-info
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CONFIGURE_ARGS+=	--enable-debug
+.endif
+
+.if !empty(PKG_OPTIONS:Mgtk3)
+PLIST.gtk=		yes
+CONFIGURE_ARGS+=	--enable-gtk
+.include "../../x11/gtk3/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-gtk
+.endif
+
+.if !empty(PKG_OPTIONS:Mopengl)
+CONFIGURE_ARGS+=	--enable-opengl
+.include "../../graphics/MesaLib/buildlink3.mk"
+.include "../../graphics/libepoxy/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-opengl
+.endif
+
+.if !empty(PKG_OPTIONS:Msdl)
+CONFIGURE_ARGS+=	--enable-sdl
+.include "../../devel/SDL2/buildlink3.mk"
+.include "../../graphics/SDL2_image/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-sdl
+.endif
+
+# On Darwin, qemu uses Cocoa
+.if ${OPSYS} != "Darwin"
+.  if !empty(PKG_OPTIONS:Mgtk3) || \
+    !empty(PKG_OPTIONS:Mopengl) || !empty(PKG_OPTIONS:Msdl)
+PLIST.keymap=		yes
+.include "../../x11/libxkbcommon/buildlink3.mk"
+.  else
+CONFIGURE_ARGS+=	--disable-xkbcommon
+.  endif
+.endif
+
+# NB to successfully build virtfs-proxy-helper, the upstream Linux
+# header/development libraries for libcap and libattr must be installed.
+.if ${OPSYS} == "Linux" && !empty(PKG_OPTIONS:Mvirtfs-proxy-helper)
+PLIST.virtfs-proxy-helper=	yes
+CONFIGURE_ARGS+=		--enable-virtfs
+.elif ${OPSYS} == "Darwin"
+CONFIGURE_ARGS+=		--enable-virtfs
+.else
+CONFIGURE_ARGS+=		--disable-virtfs
+.endif
+
+.if !empty(PKG_OPTIONS:Mspice)
+CONFIGURE_ARGS+=	--enable-spice
+.include "../../sysutils/spice-protocol/buildlink3.mk"
+.include "../../sysutils/spice-server/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-spice
+.endif
+
+.if !empty(PKG_OPTIONS:Miscsi)
+CONFIGURE_ARGS+=	--enable-libiscsi
+.include "../../net/libiscsi/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-libiscsi
+.endif
diff --git a/qemu-guest-agent/patches/patch-audio_jackaudio.c b/qemu-guest-agent/patches/patch-audio_jackaudio.c
new file mode 100644
index 0000000000..897cbffed2
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-audio_jackaudio.c
@@ -0,0 +1,20 @@
+$NetBSD: patch-audio_jackaudio.c,v 1.2 2022/06/11 10:13:06 bsiegert Exp $
+
+Teach it about NetBSD's and macOS' pthread_setname_np.
+
+--- audio/jackaudio.c.orig	2021-12-14 20:42:02.000000000 +0000
++++ audio/jackaudio.c
+@@ -631,7 +631,13 @@ static int qjack_thread_creator(jack_nat
+     }
+ 
+     /* set the name of the thread */
++#ifdef __NetBSD__
++    pthread_setname_np(*thread, "%s", (void *)"jack-client");
++#elif __APPLE__
++    pthread_setname_np("jack-client");
++#else
+     pthread_setname_np(*thread, "jack-client");
++#endif
+ 
+     return ret;
+ }
diff --git a/qemu-guest-agent/patches/patch-hw-mips-Kconfig b/qemu-guest-agent/patches/patch-hw-mips-Kconfig
new file mode 100644
index 0000000000..6ed9d75ce0
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw-mips-Kconfig
@@ -0,0 +1,13 @@
+$NetBSD: patch-hw-mips-Kconfig,v 1.3 2021/02/20 22:59:29 ryoon Exp $
+
+--- hw/mips/Kconfig.orig	2020-08-11 19:17:15.000000000 +0000
++++ hw/mips/Kconfig
+@@ -20,6 +20,8 @@ config MIPSSIM
+     select ISA_BUS
+     select SERIAL_ISA
+     select MIPSNET
++    select VIRTIO_MMIO
++    select OR_IRQ
+ 
+ config JAZZ
+     bool
diff --git a/qemu-guest-agent/patches/patch-hw-mips-mipssim.c b/qemu-guest-agent/patches/patch-hw-mips-mipssim.c
new file mode 100644
index 0000000000..5782411eb6
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw-mips-mipssim.c
@@ -0,0 +1,75 @@
+$NetBSD: patch-hw-mips-mipssim.c,v 1.4 2021/08/27 03:32:37 ryoon Exp $
+
+--- hw/mips/mipssim.c.orig	2021-08-04 16:29:07.000000000 +0000
++++ hw/mips/mipssim.c
+@@ -39,12 +39,20 @@
+ #include "hw/boards.h"
+ #include "hw/mips/bios.h"
+ #include "hw/loader.h"
++#include "hw/or-irq.h"
+ #include "elf.h"
+ #include "hw/sysbus.h"
+ #include "hw/qdev-properties.h"
+ #include "qemu/error-report.h"
+ #include "sysemu/qtest.h"
+ #include "sysemu/reset.h"
++#include "hw/virtio/virtio-mmio.h"
++
++#define NUM_VIRTIO_TRANSPORTS	32
++
++#define DEV_SPACING		0x10000		/* space devices every 64k */
++#define ISA_BASE		0x1fd00000
++#define	VIRTIO_MMIO_BASE	(ISA_BASE + DEV_SPACING)
+ 
+ static struct _loaderparams {
+     int ram_size;
+@@ -135,7 +143,7 @@ static void mipsnet_init(int base, qemu_
+                                 sysbus_mmio_get_region(s, 0));
+ }
+ 
+-static void
++void
+ mips_mipssim_init(MachineState *machine)
+ {
+     const char *kernel_filename = machine->kernel_filename;
+@@ -146,6 +154,7 @@ mips_mipssim_init(MachineState *machine)
+     MemoryRegion *isa = g_new(MemoryRegion, 1);
+     MemoryRegion *bios = g_new(MemoryRegion, 1);
+     Clock *cpuclk;
++    DeviceState *virtio_orgate;
+     MIPSCPU *cpu;
+     CPUMIPSState *env;
+     ResetData *reset_info;
+@@ -208,7 +217,7 @@ mips_mipssim_init(MachineState *machine)
+     /* Register 64 KB of ISA IO space at 0x1fd00000. */
+     memory_region_init_alias(isa, NULL, "isa_mmio",
+                              get_system_io(), 0, 0x00010000);
+-    memory_region_add_subregion(get_system_memory(), 0x1fd00000, isa);
++    memory_region_add_subregion(get_system_memory(), ISA_BASE, isa);
+ 
+     /*
+      * A single 16450 sits at offset 0x3f8. It is attached to
+@@ -229,6 +238,23 @@ mips_mipssim_init(MachineState *machine)
+     if (nd_table[0].used)
+         /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */
+         mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
++
++    /*
++     * virtio extention; register 32 virtio devices just after the ISA space
++     * at 0x1fd10000 with stride of 512 bytes as per i386s microvm target.
++     * register these devices in reverse order (see comments in hw/arm/virt.c)
++     */
++    virtio_orgate = DEVICE(object_new(TYPE_OR_IRQ));
++    object_property_set_int(OBJECT(virtio_orgate),
++         "num-lines", NUM_VIRTIO_TRANSPORTS, &error_fatal);
++    qdev_realize_and_unref(virtio_orgate, NULL, &error_fatal);
++
++    for (int i = NUM_VIRTIO_TRANSPORTS - 1; i >= 0; i--) {
++        sysbus_create_simple("virtio-mmio",
++            0x1fd10000 + i * 512,
++            qdev_get_gpio_in(virtio_orgate, i));
++    }
++    qdev_connect_gpio_out(DEVICE(virtio_orgate), 0, env->irq[3]);
+ }
+ 
+ static void mips_mipssim_machine_init(MachineClass *mc)
diff --git a/qemu-guest-agent/patches/patch-hw_display_omap__dss.c b/qemu-guest-agent/patches/patch-hw_display_omap__dss.c
new file mode 100644
index 0000000000..df87f09186
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_display_omap__dss.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-hw_display_omap__dss.c,v 1.3 2023/01/20 08:36:24 adam Exp $
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- hw/display/omap_dss.c.orig	2022-12-14 16:28:45.000000000 +0000
++++ hw/display/omap_dss.c
+@@ -798,18 +798,18 @@ static void omap_rfbi_write(void *opaque
+         break;
+     case 0x58:  /* RFBI_READ */
+         if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0])
+-            s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 1);
++            s->rfbi.rxbuf = (*s->rfbi.chip[0]->read)(s->rfbi.chip[0]->opaque, 1);
+         else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1])
+-            s->rfbi.rxbuf = s->rfbi.chip[1]->read(s->rfbi.chip[1]->opaque, 1);
++            s->rfbi.rxbuf = (*s->rfbi.chip[1]->read)(s->rfbi.chip[1]->opaque, 1);
+         if (!-- s->rfbi.pixels)
+             omap_rfbi_transfer_stop(s);
+         break;
+ 
+     case 0x5c:  /* RFBI_STATUS */
+         if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0])
+-            s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 0);
++            s->rfbi.rxbuf = (*s->rfbi.chip[0]->read)(s->rfbi.chip[0]->opaque, 0);
+         else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1])
+-            s->rfbi.rxbuf = s->rfbi.chip[1]->read(s->rfbi.chip[1]->opaque, 0);
++            s->rfbi.rxbuf = (*s->rfbi.chip[1]->read)(s->rfbi.chip[1]->opaque, 0);
+         if (!-- s->rfbi.pixels)
+             omap_rfbi_transfer_stop(s);
+         break;
diff --git a/qemu-guest-agent/patches/patch-hw_mips_meson.build b/qemu-guest-agent/patches/patch-hw_mips_meson.build
new file mode 100644
index 0000000000..dc3c04567a
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_mips_meson.build
@@ -0,0 +1,13 @@
+$NetBSD: patch-hw_mips_meson.build,v 1.3 2021/08/27 03:32:37 ryoon Exp $
+
+--- hw/mips/meson.build.orig	2021-08-04 16:29:07.000000000 +0000
++++ hw/mips/meson.build
+@@ -7,7 +7,7 @@ mips_ss.add(when: 'CONFIG_MIPS_CPS', if_
+ 
+ if 'CONFIG_TCG' in config_all
+ mips_ss.add(when: 'CONFIG_JAZZ', if_true: files('jazz.c'))
+-mips_ss.add(when: 'CONFIG_MIPSSIM', if_true: files('mipssim.c'))
++mips_ss.add(when: 'CONFIG_MIPSSIM', if_true: files('mipssim.c', 'mipssim_virtio.c'))
+ mips_ss.add(when: 'CONFIG_FULOONG', if_true: files('fuloong2e.c'))
+ mips_ss.add(when: 'CONFIG_MIPS_BOSTON', if_true: [files('boston.c'), fdt])
+ endif
diff --git a/qemu-guest-agent/patches/patch-hw_net_etraxfs__eth.c b/qemu-guest-agent/patches/patch-hw_net_etraxfs__eth.c
new file mode 100644
index 0000000000..834cf8dfb1
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_net_etraxfs__eth.c
@@ -0,0 +1,25 @@
+$NetBSD: patch-hw_net_etraxfs__eth.c,v 1.3 2014/01/15 18:26:20 wiz Exp $
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- hw/net/etraxfs_eth.c.orig	2013-11-27 22:15:55.000000000 +0000
++++ hw/net/etraxfs_eth.c
+@@ -185,7 +185,7 @@ static void mdio_read_req(struct qemu_md
+ 
+     phy = bus->devs[bus->addr];
+     if (phy && phy->read) {
+-        bus->data = phy->read(phy, bus->req);
++        bus->data = (*phy->read)(phy, bus->req);
+     } else {
+         bus->data = 0xffff;
+     }
+@@ -364,7 +364,7 @@ static void eth_validate_duplex(ETRAXFSE
+     int new_mm = 0;
+ 
+     phy = eth->mdio_bus.devs[eth->phyaddr];
+-    phy_duplex = !!(phy->read(phy, 18) & (1 << 11));
++    phy_duplex = !!((*phy->read)(phy, 18) & (1 << 11));
+     mac_duplex = !!(eth->regs[RW_REC_CTRL] & 128);
+ 
+     if (mac_duplex != phy_duplex) {
diff --git a/qemu-guest-agent/patches/patch-hw_net_xilinx__axienet.c b/qemu-guest-agent/patches/patch-hw_net_xilinx__axienet.c
new file mode 100644
index 0000000000..af632b972d
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_net_xilinx__axienet.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-hw_net_xilinx__axienet.c,v 1.2 2014/01/15 18:26:20 wiz Exp $
+
+Avoid conflicts with SSP read() macro in NetBSD's <ssp/unistd.h>
+(PR lib/43832: ssp causes common names to be defines)
+
+--- hw/net/xilinx_axienet.c.orig	2013-11-27 22:15:55.000000000 +0000
++++ hw/net/xilinx_axienet.c
+@@ -207,7 +207,7 @@ static uint16_t mdio_read_req(struct MDI
+ 
+     phy = bus->devs[addr];
+     if (phy && phy->read) {
+-        data = phy->read(phy, reg);
++        data = (*phy->read)(phy, reg);
+     } else {
+         data = 0xffff;
+     }
diff --git a/qemu-guest-agent/patches/patch-hw_rtc_mc146818rtc.c b/qemu-guest-agent/patches/patch-hw_rtc_mc146818rtc.c
new file mode 100644
index 0000000000..72465142ae
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_rtc_mc146818rtc.c
@@ -0,0 +1,32 @@
+$NetBSD: patch-hw_rtc_mc146818rtc.c,v 1.1 2020/10/04 20:39:25 thorpej Exp $
+
+Ensure the periodic timer is started as soon as the device is realized,
+and follow the real hardware's lead of updating the PF bit in REG_C even
+if it's not going to result in raising an interrupt.
+
+--- hw/rtc/mc146818rtc.c.orig	2020-10-01 00:56:55.574093880 +0000
++++ hw/rtc/mc146818rtc.c	2020-10-01 00:58:40.326479896 +0000
+@@ -155,9 +155,15 @@ static uint32_t rtc_periodic_clock_ticks
+ {
+     int period_code;
+ 
++#if 0
++    /*
++     * Real hardware sets the PF bit rergardless if it actually
++     * raises an interrupt.
++     */
+     if (!(s->cmos_data[RTC_REG_B] & REG_B_PIE)) {
+         return 0;
+      }
++#endif
+ 
+     period_code = s->cmos_data[RTC_REG_A] & 0x0f;
+ 
+@@ -944,6 +950,7 @@ static void rtc_realizefn(DeviceState *d
+     }
+ 
+     s->periodic_timer = timer_new_ns(rtc_clock, rtc_periodic_timer, s);
++    periodic_timer_update(s, qemu_clock_get_ns(rtc_clock), 0, true);
+     s->update_timer = timer_new_ns(rtc_clock, rtc_update_timer, s);
+     check_update_timer(s);
+ 
diff --git a/qemu-guest-agent/patches/patch-hw_scsi_scsi-disk.c b/qemu-guest-agent/patches/patch-hw_scsi_scsi-disk.c
new file mode 100644
index 0000000000..8b1be70abd
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_scsi_scsi-disk.c
@@ -0,0 +1,50 @@
+$NetBSD: patch-hw_scsi_scsi-disk.c,v 1.1 2020/09/27 21:29:57 jakllsch Exp $
+
+Fill in more of SCSI disk block size reports to guest. Allows use of
+sector sizes outside range of 256 to 32768.
+
+--- hw/scsi/scsi-disk.c.orig	2020-08-11 19:17:15.000000000 +0000
++++ hw/scsi/scsi-disk.c
+@@ -1293,9 +1293,9 @@ static int scsi_disk_emulate_mode_sense(
+         p[2] = (nb_sectors >> 8) & 0xff;
+         p[3] = nb_sectors & 0xff;
+         p[4] = 0; /* reserved */
+-        p[5] = 0; /* bytes 5-7 are the sector size in bytes */
+-        p[6] = s->qdev.blocksize >> 8;
+-        p[7] = 0;
++        p[5] = (s->qdev.blocksize >> 16) & 0xff; /* bytes 5-7 are the sector size in bytes */
++        p[6] = (s->qdev.blocksize >> 8) & 0xff;
++        p[7] = s->qdev.blocksize & 0xff;
+         p += 8;
+     }
+ 
+@@ -1993,10 +1993,10 @@ static int32_t scsi_disk_emulate_command
+         outbuf[1] = (nb_sectors >> 16) & 0xff;
+         outbuf[2] = (nb_sectors >> 8) & 0xff;
+         outbuf[3] = nb_sectors & 0xff;
+-        outbuf[4] = 0;
+-        outbuf[5] = 0;
+-        outbuf[6] = s->qdev.blocksize >> 8;
+-        outbuf[7] = 0;
++        outbuf[4] = (s->qdev.blocksize >> 24) & 0xff;;
++        outbuf[5] = (s->qdev.blocksize >> 16) & 0xff;
++        outbuf[6] = (s->qdev.blocksize >> 8) & 0xff;
++        outbuf[7] = s->qdev.blocksize & 0xff;;
+         break;
+     case REQUEST_SENSE:
+         /* Just return "NO SENSE".  */
+@@ -2062,10 +2062,10 @@ static int32_t scsi_disk_emulate_command
+             outbuf[5] = (nb_sectors >> 16) & 0xff;
+             outbuf[6] = (nb_sectors >> 8) & 0xff;
+             outbuf[7] = nb_sectors & 0xff;
+-            outbuf[8] = 0;
+-            outbuf[9] = 0;
+-            outbuf[10] = s->qdev.blocksize >> 8;
+-            outbuf[11] = 0;
++            outbuf[8] = (s->qdev.blocksize >> 24) & 0xff;
++            outbuf[9] = (s->qdev.blocksize >> 16) & 0xff;
++            outbuf[10] = (s->qdev.blocksize >> 8) & 0xff;
++            outbuf[11] = s->qdev.blocksize & 0xff;
+             outbuf[12] = 0;
+             outbuf[13] = get_physical_block_exp(&s->qdev.conf);
+ 
diff --git a/qemu-guest-agent/patches/patch-hw_usb_dev-mtp.c b/qemu-guest-agent/patches/patch-hw_usb_dev-mtp.c
new file mode 100644
index 0000000000..995ef0ead1
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-hw_usb_dev-mtp.c
@@ -0,0 +1,25 @@
+$NetBSD: patch-hw_usb_dev-mtp.c,v 1.5 2021/02/20 22:59:29 ryoon Exp $
+
+--- hw/usb/dev-mtp.c.orig	2020-12-08 16:59:44.000000000 +0000
++++ hw/usb/dev-mtp.c
+@@ -30,6 +30,10 @@
+ #include "qemu/units.h"
+ #include "qom/object.h"
+ 
++#ifndef NAME_MAX
++#define NAME_MAX 255
++#endif
++
+ /* ----------------------------------------------------------------------- */
+ 
+ enum mtp_container_type {
+@@ -618,6 +622,9 @@ static void usb_mtp_object_readdir(MTPSt
+     }
+     o->have_children = true;
+ 
++#ifndef O_DIRECTORY
++#define O_DIRECTORY	0
++#endif
+     fd = open(o->path, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
+     if (fd < 0) {
+         return;
diff --git a/qemu-guest-agent/patches/patch-meson.build b/qemu-guest-agent/patches/patch-meson.build
new file mode 100644
index 0000000000..8e0a697782
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-meson.build
@@ -0,0 +1,26 @@
+$NetBSD: patch-meson.build,v 1.14 2023/09/27 08:24:04 adam Exp $
+
+* Detect iconv in libc properly for pkgsrc (pkgsrc removes -liconv)
+  to fix qemu-system-aarch64 link.
+* Detect curses (non-ncurses{,w} too)
+
+--- meson.build.orig	2023-08-22 15:34:02.000000000 +0000
++++ meson.build
+@@ -1184,7 +1184,7 @@ if have_system and get_option('curses').
+       has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
+     endif
+     if has_curses_h
+-      curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw'])
++      curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw', 'curses'])
+       foreach curses_libname : curses_libname_list
+         libcurses = cc.find_library(curses_libname,
+                                     required: false)
+@@ -1201,7 +1201,7 @@ if have_system and get_option('curses').
+     endif
+   endif
+   if get_option('iconv').allowed()
+-    foreach link_args : [ ['-liconv'], [] ]
++    foreach link_args : [ [], ['-liconv'] ]
+       # Programs will be linked with glib and this will bring in libiconv on FreeBSD.
+       # We need to use libiconv if available because mixing libiconv's headers with
+       # the system libc does not work.
diff --git a/qemu-guest-agent/patches/patch-roms_u-boot-sam460ex_Makefile b/qemu-guest-agent/patches/patch-roms_u-boot-sam460ex_Makefile
new file mode 100644
index 0000000000..e09c20775b
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-roms_u-boot-sam460ex_Makefile
@@ -0,0 +1,32 @@
+$NetBSD: patch-roms_u-boot-sam460ex_Makefile,v 1.3 2021/02/23 09:28:33 wiz Exp $
+
+Fix unportable test(1) operator.
+
+--- roms/u-boot-sam460ex/Makefile.orig	2020-12-08 17:00:58.000000000 +0000
++++ roms/u-boot-sam460ex/Makefile
+@@ -2189,10 +2189,10 @@ M5475GFE_config :	unconfig
+ 	if [ "$${CODE}" != "0" ] ; then \
+ 		echo "#define CONFIG_SYS_NOR1SZ	$${CODE}" >> $(obj)include/config.h ; \
+ 	fi; \
+-	if [ "$${VID}" == "1" ] ; then \
++	if [ "$${VID}" = "1" ] ; then \
+ 		echo "#define CONFIG_SYS_VIDEO" >> $(obj)include/config.h ; \
+ 	fi; \
+-	if [ "$${USB}" == "1" ] ; then \
++	if [ "$${USB}" = "1" ] ; then \
+ 		echo "#define CONFIG_SYS_USBCTRL" >> $(obj)include/config.h ; \
+ 	fi
+ 	@$(MKCONFIG) -a M5475EVB m68k mcf547x_8x m547xevb freescale
+@@ -2224,10 +2224,10 @@ M5485HFE_config :	unconfig
+ 	if [ "$${CODE}" != "0" ] ; then \
+ 		echo "#define CONFIG_SYS_NOR1SZ	$${CODE}" >> $(obj)include/config.h ; \
+ 	fi; \
+-	if [ "$${VID}" == "1" ] ; then \
++	if [ "$${VID}" = "1" ] ; then \
+ 		echo "#define CONFIG_SYS_VIDEO" >> $(obj)include/config.h ; \
+ 	fi; \
+-	if [ "$${USB}" == "1" ] ; then \
++	if [ "$${USB}" = "1" ] ; then \
+ 		echo "#define CONFIG_SYS_USBCTRL" >> $(obj)include/config.h ; \
+ 	fi
+ 	@$(MKCONFIG) -a M5485EVB m68k mcf547x_8x m548xevb freescale
diff --git a/qemu-guest-agent/patches/patch-target_arm_tcg_translate-sve.c b/qemu-guest-agent/patches/patch-target_arm_tcg_translate-sve.c
new file mode 100644
index 0000000000..59f43450c1
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-target_arm_tcg_translate-sve.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-target_arm_tcg_translate-sve.c,v 1.1 2023/06/07 07:19:22 adam Exp $
+
+Avoid FSCALE define, notably on SunOS.
+
+--- target/arm/tcg/translate-sve.c.orig	2022-08-30 16:41:57.000000000 +0000
++++ target/arm/tcg/translate-sve.c
+@@ -3988,6 +3988,9 @@ TRANS_FEAT_NONSTREAMING(FTSMUL, aa64_sve
+     };                                                          \
+     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
+ 
++#ifdef FSCALE
++#undef FSCALE
++#endif
+ DO_ZPZZ_FP(FADD_zpzz, aa64_sve, sve_fadd)
+ DO_ZPZZ_FP(FSUB_zpzz, aa64_sve, sve_fsub)
+ DO_ZPZZ_FP(FMUL_zpzz, aa64_sve, sve_fmul)
diff --git a/qemu-guest-agent/patches/patch-target_i386_cpu.c b/qemu-guest-agent/patches/patch-target_i386_cpu.c
new file mode 100644
index 0000000000..f63c0e9ed8
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-target_i386_cpu.c
@@ -0,0 +1,33 @@
+$NetBSD: patch-target_i386_cpu.c,v 1.3 2023/12/28 17:15:39 adam Exp $
+
+Permit to use `-cpu host' with NVMM.
+
+--- target/i386/cpu.c.orig	2023-12-19 21:24:34.000000000 +0000
++++ target/i386/cpu.c
+@@ -26,6 +26,7 @@
+ #include "tcg/helper-tcg.h"
+ #include "sysemu/reset.h"
+ #include "sysemu/hvf.h"
++#include "sysemu/nvmm.h"
+ #include "hvf/hvf-i386.h"
+ #include "kvm/kvm_i386.h"
+ #include "sev.h"
+@@ -1643,7 +1644,7 @@ uint32_t xsave_area_size(uint64_t mask,
+ 
+ static inline bool accel_uses_host_cpuid(void)
+ {
+-    return kvm_enabled() || hvf_enabled();
++    return kvm_enabled() || hvf_enabled() || nvmm_enabled();
+ }
+ 
+ static inline uint64_t x86_cpu_xsave_xcr0_components(X86CPU *cpu)
+@@ -7314,7 +7315,8 @@ static void x86_cpu_realizefn(DeviceStat
+ 
+     if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
+         g_autofree char *name = x86_cpu_class_get_model_name(xcc);
+-        error_setg(&local_err, "CPU model '%s' requires KVM or HVF", name);
++        error_setg(&local_err,
++		   "CPU model '%s' requires KVM or HVF or NVMM", name);
+         goto out;
+     }
+ 
diff --git a/qemu-guest-agent/patches/patch-target_i386_meson.build b/qemu-guest-agent/patches/patch-target_i386_meson.build
new file mode 100644
index 0000000000..783b0f9d17
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-target_i386_meson.build
@@ -0,0 +1,14 @@
+$NetBSD: patch-target_i386_meson.build,v 1.5 2023/08/23 15:19:02 adam Exp $
+
+Permit to use `-cpu host' with NVMM.
+
+--- target/i386/meson.build.orig	2023-08-22 15:34:02.000000000 +0000
++++ target/i386/meson.build
+@@ -11,6 +11,7 @@ i386_ss.add(when: 'CONFIG_SEV', if_true:
+ # x86 cpu type
+ i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c'))
+ i386_ss.add(when: 'CONFIG_HVF', if_true: files('host-cpu.c'))
++i386_ss.add(when: 'CONFIG_NVMM', if_true: files('host-cpu.c'))
+ 
+ i386_system_ss = ss.source_set()
+ i386_system_ss.add(files(
diff --git a/qemu-guest-agent/patches/patch-target_i386_nvmm_nvmm-all.c b/qemu-guest-agent/patches/patch-target_i386_nvmm_nvmm-all.c
new file mode 100644
index 0000000000..be84b6ff3d
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-target_i386_nvmm_nvmm-all.c
@@ -0,0 +1,22 @@
+$NetBSD: patch-target_i386_nvmm_nvmm-all.c,v 1.6 2024/02/20 14:16:58 imil Exp $
+
+Permit using older nvmm version.
+
+--- target/i386/nvmm/nvmm-all.c.orig	2024-01-29 19:13:22.000000000 +0000
++++ target/i386/nvmm/nvmm-all.c
+@@ -1171,14 +1171,10 @@ nvmm_accel_init(MachineState *ms)
+         error_report("NVMM: Unable to fetch capability, error=%d", errno);
+         return -err;
+     }
+-    if (qemu_mach.cap.version < NVMM_KERN_VERSION) {
++    if (qemu_mach.cap.version > NVMM_USER_VERSION) {
+         error_report("NVMM: Unsupported version %u", qemu_mach.cap.version);
+         return -EPROGMISMATCH;
+     }
+-    if (qemu_mach.cap.state_size != sizeof(struct nvmm_x64_state)) {
+-        error_report("NVMM: Wrong state size %u", qemu_mach.cap.state_size);
+-        return -EPROGMISMATCH;
+-    }
+
+     ret = nvmm_machine_create(&qemu_mach.mach);
+     if (ret == -1) {
diff --git a/qemu-guest-agent/patches/patch-util_coroutine-ucontext.c b/qemu-guest-agent/patches/patch-util_coroutine-ucontext.c
new file mode 100644
index 0000000000..834f8e3737
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-util_coroutine-ucontext.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-util_coroutine-ucontext.c,v 1.2 2024/01/30 18:20:09 adam Exp $
+
+https://github.com/omniosorg/omnios-extra/blob/master/build/qemu/patches/0008-Temporary-coroutine-patch-pending-illumos-15206.patch
+
+--- util/coroutine-ucontext.c.orig	2024-01-29 19:13:22.000000000 +0000
++++ util/coroutine-ucontext.c
+@@ -320,6 +320,12 @@ qemu_coroutine_switch(Coroutine *from_,
+ 
+     ret = sigsetjmp(from->env, 0);
+     if (ret == 0) {
++#if defined(__sun)
++#define SIGJMP2UCONTEXT(x) ((ucontext_t *)P2ROUNDUP((uintptr_t)(x),  sizeof (upad128_t)))
++        ucontext_t *f = SIGJMP2UCONTEXT(from->env);
++        ucontext_t *t = SIGJMP2UCONTEXT(to->env);
++        t->uc_mcontext.gregs[REG_FSBASE] = f->uc_mcontext.gregs[REG_FSBASE];
++#endif
+         start_switch_fiber_asan(IS_ENABLED(CONFIG_COROUTINE_POOL) ||
+                                 action != COROUTINE_TERMINATE ?
+                                     &fake_stack_save : NULL,
diff --git a/qemu-guest-agent/patches/patch-util_osdep.c b/qemu-guest-agent/patches/patch-util_osdep.c
new file mode 100644
index 0000000000..a7a4f8cf5f
--- /dev/null
+++ b/qemu-guest-agent/patches/patch-util_osdep.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-util_osdep.c,v 1.1 2023/03/15 11:49:20 jperkin Exp $
+
+Don't use OFD locking on SunOS.
+https://github.com/omniosorg/omnios-extra/blob/master/build/qemu/patches/0002-illumos-OFD-locking-must-span-the-entire-file.patch
+
+--- util/osdep.c.orig	2022-12-14 16:28:45.000000000 +0000
++++ util/osdep.c
+@@ -31,6 +31,10 @@
+ #include "qemu/hw-version.h"
+ #include "monitor/monitor.h"
+ 
++#if defined(__sun)
++#undef F_OFD_SETLK
++#endif
++
+ static const char *hw_version = QEMU_HW_VERSION;
+ 
+ int socket_set_cork(int fd, int v)


Home | Main Index | Thread Index | Old Index