Add NVMM accelerator: configure and build logic

Signed-off-by: Kamil Rytarowski <kamil@NetBSD.org>
Signed-off-by: Reinoud Zandijk <reinoud@NetBSD.org>

Message-Id: <20210402202535.11550-2-reinoud@NetBSD.org>
[Check for nvmm_vcpu_stop. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Reinoud Zandijk 2021-04-02 22:25:32 +02:00 committed by Paolo Bonzini
parent 62cbfdd2c5
commit 74a414a1df
5 changed files with 30 additions and 5 deletions

View File

@ -1,6 +1,9 @@
config WHPX config WHPX
bool bool
config NVMM
bool
config HAX config HAX
bool bool

8
configure vendored
View File

@ -352,6 +352,7 @@ kvm="auto"
hax="auto" hax="auto"
hvf="auto" hvf="auto"
whpx="auto" whpx="auto"
nvmm="auto"
rdma="$default_feature" rdma="$default_feature"
pvrdma="$default_feature" pvrdma="$default_feature"
gprof="no" gprof="no"
@ -1107,6 +1108,10 @@ for opt do
;; ;;
--enable-hvf) hvf="enabled" --enable-hvf) hvf="enabled"
;; ;;
--disable-nvmm) nvmm="disabled"
;;
--enable-nvmm) nvmm="enabled"
;;
--disable-whpx) whpx="disabled" --disable-whpx) whpx="disabled"
;; ;;
--enable-whpx) whpx="enabled" --enable-whpx) whpx="enabled"
@ -1848,6 +1853,7 @@ disabled with --disable-FEATURE, default is enabled if available
kvm KVM acceleration support kvm KVM acceleration support
hax HAX acceleration support hax HAX acceleration support
hvf Hypervisor.framework acceleration support hvf Hypervisor.framework acceleration support
nvmm NVMM acceleration support
whpx Windows Hypervisor Platform acceleration support whpx Windows Hypervisor Platform acceleration support
rdma Enable RDMA-based migration rdma Enable RDMA-based migration
pvrdma Enable PVRDMA support pvrdma Enable PVRDMA support
@ -6410,7 +6416,7 @@ NINJA=$ninja $meson setup \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \ -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ -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 \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
-Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \

View File

@ -87,6 +87,7 @@ if cpu in ['x86', 'x86_64']
accelerator_targets += { accelerator_targets += {
'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_HVF': ['x86_64-softmmu'],
'CONFIG_NVMM': ['i386-softmmu', 'x86_64-softmmu'],
'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
} }
endif endif
@ -170,6 +171,7 @@ version_res = []
coref = [] coref = []
iokit = [] iokit = []
emulator_link_args = [] emulator_link_args = []
nvmm =not_found
hvf = not_found hvf = not_found
if targetos == 'windows' if targetos == 'windows'
socket = cc.find_library('ws2_32') socket = cc.find_library('ws2_32')
@ -227,6 +229,14 @@ if not get_option('hax').disabled()
accelerators += 'CONFIG_HAX' accelerators += 'CONFIG_HAX'
endif endif
endif endif
if targetos == 'netbsd'
if cc.has_header_symbol('nvmm.h', 'nvmm_cpu_stop', required: get_option('nvmm'))
nvmm = cc.find_library('nvmm', required: get_option('nvmm'))
endif
if nvmm.found()
accelerators += 'CONFIG_NVMM'
endif
endif
tcg_arch = config_host['ARCH'] tcg_arch = config_host['ARCH']
if not get_option('tcg').disabled() if not get_option('tcg').disabled()
@ -270,6 +280,9 @@ endif
if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled() if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled()
error('HVF not available on this platform') error('HVF not available on this platform')
endif 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() if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
error('WHPX not available on this platform') error('WHPX not available on this platform')
endif endif
@ -2581,6 +2594,7 @@ if have_system
summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}
summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')} summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')}
summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')} summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
summary_info += {'NVMM support': config_all.has_key('CONFIG_NVMM')}
summary_info += {'Xen support': config_host.has_key('CONFIG_XEN_BACKEND')} summary_info += {'Xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
if config_host.has_key('CONFIG_XEN_BACKEND') if config_host.has_key('CONFIG_XEN_BACKEND')
summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}

View File

@ -33,6 +33,8 @@ option('whpx', type: 'feature', value: 'auto',
description: 'WHPX acceleration support') description: 'WHPX acceleration support')
option('hvf', type: 'feature', value: 'auto', option('hvf', type: 'feature', value: 'auto',
description: 'HVF acceleration support') description: 'HVF acceleration support')
option('nvmm', type: 'feature', value: 'auto',
description: 'NVMM acceleration support')
option('xen', type: 'feature', value: 'auto', option('xen', type: 'feature', value: 'auto',
description: 'Xen backend support') description: 'Xen backend support')
option('xen_pci_passthrough', type: 'feature', value: 'auto', option('xen_pci_passthrough', type: 'feature', value: 'auto',

View File

@ -26,7 +26,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
"-machine [type=]name[,prop[=value][,...]]\n" "-machine [type=]name[,prop[=value][,...]]\n"
" selects emulated machine ('-machine help' for list)\n" " selects emulated machine ('-machine help' for list)\n"
" property accel=accel1[:accel2[:...]] selects accelerator\n" " property accel=accel1[:accel2[:...]] selects accelerator\n"
" supported accelerators are kvm, xen, hax, hvf, whpx or tcg (default: tcg)\n" " supported accelerators are kvm, xen, hax, hvf, nvmm, whpx or tcg (default: tcg)\n"
" vmport=on|off|auto controls emulation of vmport (default: auto)\n" " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
" dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
" mem-merge=on|off controls memory merge support (default: on)\n" " mem-merge=on|off controls memory merge support (default: on)\n"
@ -58,7 +58,7 @@ SRST
``accel=accels1[:accels2[:...]]`` ``accel=accels1[:accels2[:...]]``
This is used to enable an accelerator. Depending on the target This is used to enable an accelerator. Depending on the target
architecture, kvm, xen, hax, hvf, whpx or tcg can be available. architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available.
By default, tcg is used. If there is more than one accelerator By default, tcg is used. If there is more than one accelerator
specified, the next one is used if the previous one fails to specified, the next one is used if the previous one fails to
initialize. initialize.
@ -135,7 +135,7 @@ ERST
DEF("accel", HAS_ARG, QEMU_OPTION_accel, DEF("accel", HAS_ARG, QEMU_OPTION_accel,
"-accel [accel=]accelerator[,prop[=value][,...]]\n" "-accel [accel=]accelerator[,prop[=value][,...]]\n"
" select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n" " select accelerator (kvm, xen, hax, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
" igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
" kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n" " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
" kvm-shadow-mem=size of KVM shadow MMU in bytes\n" " kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
@ -145,7 +145,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel,
SRST SRST
``-accel name[,prop=value[,...]]`` ``-accel name[,prop=value[,...]]``
This is used to enable an accelerator. Depending on the target This is used to enable an accelerator. Depending on the target
architecture, kvm, xen, hax, hvf, whpx or tcg can be available. By architecture, kvm, xen, hax, hvf, nvmm, whpx or tcg can be available. By
default, tcg is used. If there is more than one accelerator default, tcg is used. If there is more than one accelerator
specified, the next one is used if the previous one fails to specified, the next one is used if the previous one fails to
initialize. initialize.