pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/emulators/qemu nvmm: Merge NVMM support



details:   https://anonhg.NetBSD.org/pkgsrc/rev/91aeb4e38dc7
branches:  trunk
changeset: 411158:91aeb4e38dc7
user:      kamil <kamil%pkgsrc.org@localhost>
date:      Thu Feb 06 16:46:17 2020 +0000

description:
nvmm: Merge NVMM support

NVMM v3 patchset pending upstream.

https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg01405.html

diffstat:

 emulators/qemu/distinfo                                 |    13 +-
 emulators/qemu/patches/patch-accel_stubs_Makefile.objs  |    13 +
 emulators/qemu/patches/patch-accel_stubs_nvmm-stub.c    |    50 +
 emulators/qemu/patches/patch-configure                  |   107 +-
 emulators/qemu/patches/patch-cpus.c                     |    92 +
 emulators/qemu/patches/patch-include_sysemu_hw__accel.h |    55 +
 emulators/qemu/patches/patch-include_sysemu_nvmm.h      |    42 +
 emulators/qemu/patches/patch-qemu-options.hx            |    48 +
 emulators/qemu/patches/patch-target_i386_Makefile.objs  |    14 +
 emulators/qemu/patches/patch-target_i386_helper.c       |    15 +
 emulators/qemu/patches/patch-target_i386_nvmm-all.c     |  1228 +++++++++++++++
 11 files changed, 1668 insertions(+), 9 deletions(-)

diffs (truncated from 1750 to 300 lines):

diff -r 37b34056fa21 -r 91aeb4e38dc7 emulators/qemu/distinfo
--- a/emulators/qemu/distinfo   Thu Feb 06 15:58:09 2020 +0000
+++ b/emulators/qemu/distinfo   Thu Feb 06 16:46:17 2020 +0000
@@ -1,24 +1,33 @@
-$NetBSD: distinfo,v 1.153 2019/12/15 18:35:25 adam Exp $
+$NetBSD: distinfo,v 1.154 2020/02/06 16:46:17 kamil Exp $
 
 SHA1 (qemu-4.2.0.tar.xz) = b27aa828a8457bd8551ae3c81b80cc365e1f6bfe
 RMD160 (qemu-4.2.0.tar.xz) = cab8f6d85c0c6e9c01059087ed27d1243a7004a4
 SHA512 (qemu-4.2.0.tar.xz) = 2a79973c2b07c53e8c57a808ea8add7b6b2cbca96488ed5d4b669ead8c9318907dec2b6109f180fc8ca8f04c0f73a56e82b3a527b5626b799d7e849f2474ec56
 Size (qemu-4.2.0.tar.xz) = 62222068 bytes
 SHA1 (patch-Makefile) = 85d24d842ad2f7e1e2ec6f0e0e3268c21ef9bf0d
+SHA1 (patch-accel_stubs_Makefile.objs) = 92266dc400ac1e97013f7f19ee4b7a63b42c7fc0
+SHA1 (patch-accel_stubs_nvmm-stub.c) = d66d47eabb8bb6728e777da7589b43d491adbcc8
 SHA1 (patch-accel_tcg_user-exec.c) = 86ee62f6e5c8cd7942cf0aa9c9f64e4b0879ff33
 SHA1 (patch-capstone_Makefile) = f59870031de8c4385a591362749ec82f57fd4c27
-SHA1 (patch-configure) = 14c09363622bcee113b7fda5bd3f031bd9ff6b90
+SHA1 (patch-configure) = c2d68edf08e94ea12c9e57da3dacb0c1326c1213
 SHA1 (patch-contrib_ivshmem-client_ivshmem-client.c) = 40c8751607cbf66a37e4c4e08f2664b864e2e984
 SHA1 (patch-contrib_ivshmem-server_ivshmem-server.c) = d8f53432b5752f4263dc4ef96108a976a05147a3
+SHA1 (patch-cpus.c) = a319b7533daf3036c44411c4b26270b1fbb96009
 SHA1 (patch-hw_core_uboot__image.h) = 17eef02349343c5fcfb7a4069cb6f8fd11efcb59
 SHA1 (patch-hw_display_omap__dss.c) = 6b13242f28e32346bc70548c216c578d98fd3420
 SHA1 (patch-hw_net_etraxfs__eth.c) = e5dd1661d60dbcd27b332403e0843500ba9544bc
 SHA1 (patch-hw_net_xilinx__axienet.c) = ebcd2676d64ce6f31e4a8c976d4fdf530ad5e8b7
 SHA1 (patch-hw_tpm_tpm__ioctl.h) = a350c1708e1f9d85e07c4c354068703a45174baf
 SHA1 (patch-hw_usb_dev-mtp.c) = 0f9034fb3904e5d5e3b98d24b94e054181687d95
+SHA1 (patch-include_sysemu_hw__accel.h) = e5f581fa0539e55a6a1d559b94e94d47aedb88d7
 SHA1 (patch-include_sysemu_kvm.h) = 9847abe3be70bd708a521310f5d5515e45a1a5a0
+SHA1 (patch-include_sysemu_nvmm.h) = 3bd3da9b42ace0f806fabeb580f90ae19c273869
 SHA1 (patch-net_tap-solaris.c) = cc953c9a624dd55ace4e130d0b31bbfb956c17d5
 SHA1 (patch-qemu-doc.texi) = 78f926a16494c07248b9a81f39dca5b78ae542bb
+SHA1 (patch-qemu-options.hx) = 17fb92e03e32402ea2c04217991a2cd01a335e02
 SHA1 (patch-roms_u-boot_tools_imx8m__image.sh) = e4c452062f40569e33aa93eec4a65bd3af2e74fc
+SHA1 (patch-target_i386_Makefile.objs) = be8ab2e72521ccd0a71db6b37feb9957b27ac970
+SHA1 (patch-target_i386_helper.c) = 54363fe53688ea4030665b3bbb3ee7aba7ba5348
 SHA1 (patch-target_i386_kvm-stub.c) = 4cd2b7a8d8d8a317829f982b5acff7fdf2479d9f
+SHA1 (patch-target_i386_nvmm-all.c) = 4b6d29456d3ad6409ce0cd83ef95d2226a7aab33
 SHA1 (patch-util_drm.c) = b30a46d623d9431c5af2f3cd101adb89be3f0c2b
diff -r 37b34056fa21 -r 91aeb4e38dc7 emulators/qemu/patches/patch-accel_stubs_Makefile.objs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-accel_stubs_Makefile.objs    Thu Feb 06 16:46:17 2020 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-accel_stubs_Makefile.objs,v 1.1 2020/02/06 16:46:17 kamil Exp $
+
+Add NVMM support.
+
+--- accel/stubs/Makefile.objs.orig     2019-12-12 18:20:47.000000000 +0000
++++ accel/stubs/Makefile.objs
+@@ -1,5 +1,6 @@
+ obj-$(call lnot,$(CONFIG_HAX))  += hax-stub.o
+ obj-$(call lnot,$(CONFIG_HVF))  += hvf-stub.o
+ obj-$(call lnot,$(CONFIG_WHPX)) += whpx-stub.o
++obj-$(call lnot,$(CONFIG_NVMM)) += nvmm-stub.o
+ obj-$(call lnot,$(CONFIG_KVM))  += kvm-stub.o
+ obj-$(call lnot,$(CONFIG_TCG))  += tcg-stub.o
diff -r 37b34056fa21 -r 91aeb4e38dc7 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      Thu Feb 06 16:46:17 2020 +0000
@@ -0,0 +1,50 @@
+$NetBSD: patch-accel_stubs_nvmm-stub.c,v 1.1 2020/02/06 16:46:17 kamil 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 37b34056fa21 -r 91aeb4e38dc7 emulators/qemu/patches/patch-configure
--- a/emulators/qemu/patches/patch-configure    Thu Feb 06 15:58:09 2020 +0000
+++ b/emulators/qemu/patches/patch-configure    Thu Feb 06 16:46:17 2020 +0000
@@ -1,14 +1,107 @@
-$NetBSD: patch-configure,v 1.25 2019/04/24 13:59:32 ryoon Exp $
+$NetBSD: patch-configure,v 1.26 2020/02/06 16:46:17 kamil Exp $
 
 configure: Add HAX support in NetBSD
+Add NVMM support.
 
---- configure.orig     2019-04-23 18:14:45.000000000 +0000
+--- configure.orig     2020-02-06 16:24:52.903915848 +0000
 +++ configure
-@@ -815,6 +815,7 @@ FreeBSD)
- ;;
- DragonFly)
+@@ -241,6 +241,17 @@ supported_whpx_target() {
+     return 1
+ }
+ 
++supported_nvmm_target() {
++    test "$nvmm" = "yes" || return 1
++    glob "$1" "*-softmmu" || return 1
++    case "${1%-softmmu}" in
++        i386|x86_64)
++            return 0
++        ;;
++    esac
++    return 1
++}
++
+ supported_target() {
+     case "$1" in
+         *-softmmu)
+@@ -268,6 +279,7 @@ supported_target() {
+     supported_hax_target "$1" && return 0
+     supported_hvf_target "$1" && return 0
+     supported_whpx_target "$1" && return 0
++    supported_nvmm_target "$1" && return 0
+     print_error "TCG disabled, but hardware accelerator not available for '$target'"
+     return 1
+ }
+@@ -387,6 +399,7 @@ kvm="no"
+ hax="no"
+ hvf="no"
+ whpx="no"
++nvmm="no"
+ rdma=""
+ pvrdma=""
+ gprof="no"
+@@ -822,6 +835,7 @@ DragonFly)
+ NetBSD)
    bsd="yes"
-+  hax="yes"
+   hax="yes"
++  nvmm="yes"
    make="${MAKE-gmake}"
    audio_drv_list="oss try-sdl"
-   audio_possible_drivers="oss sdl pa"
+   audio_possible_drivers="oss sdl"
+@@ -1172,6 +1186,10 @@ for opt do
+   ;;
+   --enable-whpx) whpx="yes"
+   ;;
++  --disable-nvmm) nvmm="no"
++  ;;
++  --enable-nvmm) nvmm="yes"
++  ;;
+   --disable-tcg-interpreter) tcg_interpreter="no"
+   ;;
+   --enable-tcg-interpreter) tcg_interpreter="yes"
+@@ -1768,6 +1786,7 @@ disabled with --disable-FEATURE, default
+   hax             HAX acceleration support
+   hvf             Hypervisor.framework acceleration support
+   whpx            Windows Hypervisor Platform acceleration support
++  nvmm            NetBSD Virtual Machine Monitor acceleration support
+   rdma            Enable RDMA-based migration
+   pvrdma          Enable PVRDMA support
+   vde             support for vde network
+@@ -2758,6 +2777,20 @@ if test "$whpx" != "no" ; then
+ fi
+ 
+ ##########################################
++# NetBSD Virtual Machine Monitor (NVMM) accelerator check
++if test "$nvmm" != "no" ; then
++    if check_include "nvmm.h" ; then
++        nvmm="yes"
++      LIBS="-lnvmm $LIBS"
++    else
++        if test "$nvmm" = "yes"; then
++            feature_not_found "NVMM" "NVMM is not available"
++        fi
++        nvmm="no"
++    fi
++fi
++
++##########################################
+ # Sparse probe
+ if test "$sparse" != "no" ; then
+   if has cgcc; then
+@@ -6522,6 +6555,7 @@ echo "KVM support       $kvm"
+ echo "HAX support       $hax"
+ echo "HVF support       $hvf"
+ echo "WHPX support      $whpx"
++echo "NVMM support      $nvmm"
+ echo "TCG support       $tcg"
+ if test "$tcg" = "yes" ; then
+     echo "TCG debug enabled $debug_tcg"
+@@ -7811,6 +7845,9 @@ fi
+ if test "$target_aligned_only" = "yes" ; then
+   echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak
+ fi
++if supported_nvmm_target $target; then
++    echo "CONFIG_NVMM=y" >> $config_target_mak
++fi
+ if test "$target_bigendian" = "yes" ; then
+   echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
+ fi
diff -r 37b34056fa21 -r 91aeb4e38dc7 emulators/qemu/patches/patch-cpus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/qemu/patches/patch-cpus.c       Thu Feb 06 16:46:17 2020 +0000
@@ -0,0 +1,92 @@
+$NetBSD: patch-cpus.c,v 1.1 2020/02/06 16:46:17 kamil Exp $
+
+Add NVMM support.
+
+--- cpus.c.orig        2019-12-12 18:20:47.000000000 +0000
++++ cpus.c
+@@ -42,6 +42,7 @@
+ #include "sysemu/hax.h"
+ #include "sysemu/hvf.h"
+ #include "sysemu/whpx.h"
++#include "sysemu/nvmm.h"
+ #include "exec/exec-all.h"
+ 
+ #include "qemu/thread.h"
+@@ -1738,6 +1739,48 @@ static void *qemu_whpx_cpu_thread_fn(voi
+     return NULL;
+ }
+ 
++static void *qemu_nvmm_cpu_thread_fn(void *arg)
++{
++    CPUState *cpu = arg;
++    int r;
++
++    assert(nvmm_enabled());
++
++    rcu_register_thread();
++
++    qemu_mutex_lock_iothread();
++    qemu_thread_get_self(cpu->thread);
++    cpu->thread_id = qemu_get_thread_id();
++    current_cpu = cpu;
++
++    r = nvmm_init_vcpu(cpu);
++    if (r < 0) {
++        fprintf(stderr, "nvmm_init_vcpu failed: %s\n", strerror(-r));
++        exit(1);
++    }
++
++    /* signal CPU creation */
++    cpu->created = true;
++    qemu_cond_signal(&qemu_cpu_cond);
++
++    do {
++        if (cpu_can_run(cpu)) {
++            r = nvmm_vcpu_exec(cpu);
++            if (r == EXCP_DEBUG) {
++                cpu_handle_guest_debug(cpu);
++            }
++        }
++        qemu_wait_io_event(cpu);
++    } while (!cpu->unplug || cpu_can_run(cpu));
++
++    nvmm_destroy_vcpu(cpu);
++    cpu->created = false;
++    qemu_cond_signal(&qemu_cpu_cond);
++    qemu_mutex_unlock_iothread();
++    rcu_unregister_thread();
++    return NULL;
++}
++
+ #ifdef _WIN32
+ static void CALLBACK dummy_apc_func(ULONG_PTR unused)
+ {
+@@ -2101,6 +2144,19 @@ static void qemu_whpx_start_vcpu(CPUStat
+ #endif
+ }
+ 
++static void qemu_nvmm_start_vcpu(CPUState *cpu)



Home | Main Index | Thread Index | Old Index