pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/emulators/qemu Re-add the NetBSD/amd64 Virtual Memory ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/4b48cae7d3de
branches: trunk
changeset: 448221:4b48cae7d3de
user: reinoud <reinoud%pkgsrc.org@localhost>
date: Sat Mar 06 11:19:34 2021 +0000
description:
Re-add the NetBSD/amd64 Virtual Memory Monitor (NVMM) support to QEMU 5.2.0
thanks go to Ryo ONODERA <ryo%tetera.org@localhost> for his help with the build logic
diffstat:
emulators/qemu/MESSAGE | 25 +
emulators/qemu/Makefile | 3 +-
emulators/qemu/distinfo | 15 +-
emulators/qemu/patches/patch-accel_stubs_nvmm-stub.c | 50 +
emulators/qemu/patches/patch-configure | 43 +
emulators/qemu/patches/patch-include_sysemu_hw_accel.h | 12 +
emulators/qemu/patches/patch-include_sysemu_nvmm.h | 31 +
emulators/qemu/patches/patch-meson.build | 71 +-
emulators/qemu/patches/patch-meson__options.txt | 13 +
emulators/qemu/patches/patch-qemu-options.hx | 42 +
emulators/qemu/patches/patch-target_i386_helper.c | 13 +
emulators/qemu/patches/patch-target_i386_meson.build | 15 +
emulators/qemu/patches/patch-target_i386_nvmm_all.c | 1221 ++++++++++++++++
emulators/qemu/patches/patch-target_i386_nvmm_cpus.c | 105 +
emulators/qemu/patches/patch-target_i386_nvmm_cpus.h | 32 +
15 files changed, 1686 insertions(+), 5 deletions(-)
diffs (truncated from 1795 to 300 lines):
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/MESSAGE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/MESSAGE Sat Mar 06 11:19:34 2021 +0000
@@ -0,0 +1,25 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2021/03/06 11:19:34 reinoud 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
+# chown root:nvmm ${PREFIX}/bin/qemu-system-x86_64
+# chmod g+s ${PREFIX}/bin/qemu-system-x86_64
+# chown root:nvmm ${PREFIX}/bin/qemu-system-i386
+# chmod g+s ${PREFIX}/bin/qemu-system-i386
+
+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 -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/Makefile
--- a/emulators/qemu/Makefile Sat Mar 06 10:30:15 2021 +0000
+++ b/emulators/qemu/Makefile Sat Mar 06 11:19:34 2021 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.264 2021/02/23 09:28:33 wiz Exp $
+# $NetBSD: Makefile,v 1.265 2021/03/06 11:19:34 reinoud Exp $
DISTNAME= qemu-5.2.0
+PKGREVISION= 1
CATEGORIES= emulators
MASTER_SITES= https://download.qemu.org/
EXTRACT_SUFX= .tar.xz
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/distinfo
--- a/emulators/qemu/distinfo Sat Mar 06 10:30:15 2021 +0000
+++ b/emulators/qemu/distinfo Sat Mar 06 11:19:34 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.171 2021/02/23 09:28:33 wiz Exp $
+$NetBSD: distinfo,v 1.172 2021/03/06 11:19:34 reinoud Exp $
SHA1 (palcode-clipper) = e25ae10a10e0801e47b62b9ee2d10c8ccb4ee940
RMD160 (palcode-clipper) = a637f1cc38dabfdff36e3f02b6dd02d7c63cb8db
@@ -8,7 +8,9 @@
RMD160 (qemu-5.2.0.tar.xz) = 2c33e773f012e333f99237e3d4ff1653ea0bc88f
SHA512 (qemu-5.2.0.tar.xz) = bddd633ce111471ebc651e03080251515178808556b49a308a724909e55dac0be0cc0c79c536ac12d239678ae94c60100dc124be9b9d9538340c03a2f27177f3
Size (qemu-5.2.0.tar.xz) = 106902800 bytes
+SHA1 (patch-accel_stubs_nvmm-stub.c) = d66d47eabb8bb6728e777da7589b43d491adbcc8
SHA1 (patch-backends_tpm_tpm__ioctl.h) = fbd6c877ad605f7120290efbb0ac653c69f351de
+SHA1 (patch-configure) = 8b392c5633c70d65f2f27af3b617a53af9772899
SHA1 (patch-contrib_ivshmem-client_ivshmem-client.c) = 40c8751607cbf66a37e4c4e08f2664b864e2e984
SHA1 (patch-contrib_ivshmem-server_ivshmem-server.c) = d8f53432b5752f4263dc4ef96108a976a05147a3
SHA1 (patch-hw-mips-Kconfig) = c7199ad26ac45116ab4d38252db4234ae93bdf9a
@@ -24,9 +26,13 @@
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-include_sysemu_hw_accel.h) = d083cd51434e28eb0d647b5107d34018b0ef63dc
SHA1 (patch-include_sysemu_kvm.h) = 9847abe3be70bd708a521310f5d5515e45a1a5a0
-SHA1 (patch-meson.build) = 5f9e00312b2dc6a6b1c43b1f28d092e69b09091d
+SHA1 (patch-include_sysemu_nvmm.h) = 1fe49c4f11910d6faf683ae3233f783a0b03ce5a
+SHA1 (patch-meson.build) = 65f1f51403b6def24640396ad26bb7c25a16dae0
+SHA1 (patch-meson__options.txt) = 286d097f596baa5af244a990d2874f1a7ee65198
SHA1 (patch-net_tap-solaris.c) = cc953c9a624dd55ace4e130d0b31bbfb956c17d5
+SHA1 (patch-qemu-options.hx) = e2f264117f703aa4ccf56219f370c3b1303e8b07
SHA1 (patch-roms_qemu-palcode_hwrpb.h) = ae7b4c0680367af6f740d62a54dc86352128d76f
SHA1 (patch-roms_qemu-palcode_init.c) = 7a0ebcd86f4106318791e7d90273fb55a424f1b8
SHA1 (patch-roms_qemu-palcode_memcpy.c) = 7761774ae9092d0f494deaf302d663ba479a09cf
@@ -40,5 +46,10 @@
SHA1 (patch-roms_qemu-palcode_vgaio.c) = c8d7adc053cd6655f005527d16647611040c09d2
SHA1 (patch-roms_u-boot-sam460ex_Makefile) = 3a1bbf19b1422c10ebdd819eb0b711fafc78e2f2
SHA1 (patch-roms_u-boot_tools_imx8m__image.sh) = e4c452062f40569e33aa93eec4a65bd3af2e74fc
+SHA1 (patch-target_i386_helper.c) = 3314e65df11492438af2ec2c53ed3082a0b62b09
SHA1 (patch-target_i386_kvm-stub.c) = 4cd2b7a8d8d8a317829f982b5acff7fdf2479d9f
+SHA1 (patch-target_i386_meson.build) = d0e0d7d4dd96ea43fc386e7166bbabbd71b0f4fc
+SHA1 (patch-target_i386_nvmm_all.c) = dd22747aa0b94bc371303fc865d523d3623ec043
+SHA1 (patch-target_i386_nvmm_cpus.c) = 7f028bf2637fe31d8524f710a9e508c8ce65c822
+SHA1 (patch-target_i386_nvmm_cpus.h) = 0a25e49929cb772fc46a4ace91127ccf3605521d
SHA1 (patch-target_sparc_translate.c) = 7ec2add2fd808facb48b9a66ccc345599251bf76
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/patches/patch-accel_stubs_nvmm-stub.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-accel_stubs_nvmm-stub.c Sat Mar 06 11:19:34 2021 +0000
@@ -0,0 +1,50 @@
+$NetBSD: patch-accel_stubs_nvmm-stub.c,v 1.3 2021/03/06 11:19:34 reinoud Exp $
+
+Add NVMM support.
+
+--- accel/stubs/nvmm-stub.c.orig 2020-02-06 16:25:13.966864001 +0000
++++ accel/stubs/nvmm-stub.c
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2018-2019 Maxime Villard, All rights reserved.
++ *
++ * NetBSD Virtual Machine Monitor (NVMM) accelerator stub.
++ *
++ * This work is licensed under the terms of the GNU GPL, version 2 or later.
++ * See the COPYING file in the top-level directory.
++ */
++
++#include "qemu/osdep.h"
++#include "qemu-common.h"
++#include "cpu.h"
++#include "sysemu/nvmm.h"
++
++int nvmm_init_vcpu(CPUState *cpu)
++{
++ return -1;
++}
++
++int nvmm_vcpu_exec(CPUState *cpu)
++{
++ return -1;
++}
++
++void nvmm_destroy_vcpu(CPUState *cpu)
++{
++}
++
++void nvmm_cpu_synchronize_state(CPUState *cpu)
++{
++}
++
++void nvmm_cpu_synchronize_post_reset(CPUState *cpu)
++{
++}
++
++void nvmm_cpu_synchronize_post_init(CPUState *cpu)
++{
++}
++
++void nvmm_cpu_synchronize_pre_loadvm(CPUState *cpu)
++{
++}
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/patches/patch-configure
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-configure Sat Mar 06 11:19:34 2021 +0000
@@ -0,0 +1,43 @@
+$NetBSD: patch-configure,v 1.31 2021/03/06 11:19:34 reinoud Exp $
+
+Add NVMM support.
+Fix jemalloc detection.
+
+--- configure.orig 2020-12-08 16:59:44.000000000 +0000
++++ configure
+@@ -334,6 +334,7 @@ vhost_user_fs=""
+ kvm="auto"
+ hax="auto"
+ hvf="auto"
++nvmm="auto"
+ whpx="auto"
+ rdma=""
+ pvrdma=""
+@@ -1102,6 +1103,10 @@ for opt do
+ ;;
+ --enable-hvf) hvf="enabled"
+ ;;
++ --disable-nvmm) nvmm="disabled"
++ ;;
++ --enable-nvmm) nvmm="enabled"
++ ;;
+ --disable-whpx) whpx="disabled"
+ ;;
+ --enable-whpx) whpx="enabled"
+@@ -1783,6 +1788,7 @@ disabled with --disable-FEATURE, default
+ kvm KVM acceleration support
+ hax HAX acceleration support
+ hvf Hypervisor.framework acceleration support
++ nvmm NVMM acceleration support
+ whpx Windows Hypervisor Platform acceleration support
+ rdma Enable RDMA-based migration
+ pvrdma Enable PVRDMA support
+@@ -7005,7 +7011,7 @@ NINJA=$ninja $meson setup \
+ ${staticpic:+-Db_staticpic=$staticpic} \
+ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
+ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
+- -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
++ -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \
+ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
+ -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
+ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/patches/patch-include_sysemu_hw_accel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-include_sysemu_hw_accel.h Sat Mar 06 11:19:34 2021 +0000
@@ -0,0 +1,12 @@
+$NetBSD: patch-include_sysemu_hw_accel.h,v 1.1 2021/03/06 11:19:34 reinoud Exp $
+
+--- include/sysemu/hw_accel.h.orig 2020-12-08 16:59:44.000000000 +0000
++++ include/sysemu/hw_accel.h
+@@ -16,6 +16,7 @@
+ #include "sysemu/kvm.h"
+ #include "sysemu/hvf.h"
+ #include "sysemu/whpx.h"
++#include "sysemu/nvmm.h"
+
+ void cpu_synchronize_state(CPUState *cpu);
+ void cpu_synchronize_post_reset(CPUState *cpu);
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/patches/patch-include_sysemu_nvmm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-include_sysemu_nvmm.h Sat Mar 06 11:19:34 2021 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-include_sysemu_nvmm.h,v 1.3 2021/03/06 11:19:34 reinoud Exp $
+
+--- include/sysemu/nvmm.h.orig 2021-03-05 22:29:22.991663471 +0000
++++ include/sysemu/nvmm.h
+@@ -0,0 +1,26 @@
++/*
++ * Copyright (c) 2018-2019 Maxime Villard, All rights reserved.
++ *
++ * NetBSD Virtual Machine Monitor (NVMM) accelerator support.
++ *
++ * This work is licensed under the terms of the GNU GPL, version 2 or later.
++ * See the COPYING file in the top-level directory.
++ */
++
++#ifndef QEMU_NVMM_H
++#define QEMU_NVMM_H
++
++#include "config-host.h"
++#include "qemu-common.h"
++
++#ifdef CONFIG_NVMM
++
++int nvmm_enabled(void);
++
++#else /* CONFIG_NVMM */
++
++#define nvmm_enabled() (0)
++
++#endif /* CONFIG_NVMM */
++
++#endif /* CONFIG_NVMM */
diff -r 6693d7a351bb -r 4b48cae7d3de emulators/qemu/patches/patch-meson.build
--- a/emulators/qemu/patches/patch-meson.build Sat Mar 06 10:30:15 2021 +0000
+++ b/emulators/qemu/patches/patch-meson.build Sat Mar 06 11:19:34 2021 +0000
@@ -1,11 +1,61 @@
-$NetBSD: patch-meson.build,v 1.1 2021/02/20 22:59:29 ryoon Exp $
+$NetBSD: patch-meson.build,v 1.2 2021/03/06 11:19:34 reinoud Exp $
+* Add NetBSD support.
* Detect iconv in libc properly for pkgsrc (pkgsrc removes -liconv)
to fix qemu-system-aarch64 link.
--- meson.build.orig 2020-12-08 16:59:44.000000000 +0000
+++ meson.build
-@@ -535,7 +535,7 @@ if have_system and not get_option('curse
+@@ -84,6 +84,7 @@ if cpu in ['x86', 'x86_64']
+ accelerator_targets += {
+ 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
+ 'CONFIG_HVF': ['x86_64-softmmu'],
++ 'CONFIG_NVMM': ['x86_64-softmmu'],
+ 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
+ }
+ endif
+@@ -169,6 +170,7 @@ version_res = []
+ coref = []
+ iokit = []
+ emulator_link_args = []
++nvmm = []
+ cocoa = not_found
+ hvf = not_found
+ if targetos == 'windows'
+@@ -196,6 +198,10 @@ elif targetos == 'openbsd'
+ # Disable OpenBSD W^X if available
+ emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
+ endif
++elif targetos == 'netbsd'
++ if not get_option('nvmm').disabled()
++ nvmm = cc.find_library('nvmm')
++ endif
+ endif
+
+ accelerators = []
+@@ -228,6 +234,11 @@ if not get_option('hax').disabled()
+ accelerators += 'CONFIG_HAX'
+ endif
+ endif
++if not get_option('nvmm').disabled()
++ if cc.has_header('nvmm.h', required: get_option('nvmm'))
++ accelerators += 'CONFIG_NVMM'
++ endif
++endif
+ if not get_option('tcg').disabled()
+ if cpu not in supported_cpus
+ if 'CONFIG_TCG_INTERPRETER' in config_host
+@@ -246,6 +257,9 @@ endif
+ if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
+ error('HVF not available on this platform')
+ endif
++if 'CONFIG_NVMM' not in accelerators and get_option('nvmm').enabled()
++ error('NVMM not available on this platform')
++endif
+ if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
+ error('WHPX not available on this platform')
Home |
Main Index |
Thread Index |
Old Index