[kvm-unit-tests PATCH 1/2] scripts/arch-run: Support testing of hvf accel

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

 



The tests can be run if Hypervisor.framework API is available:

  https://developer.apple.com/documentation/hypervisor?language=objc#1676667

Cc: Cameron Esfahani <dirty@xxxxxxxxx>
Signed-off-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>
---
 scripts/arch-run.bash | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index d3ca19d..197ae6c 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -315,17 +315,30 @@ kvm_available ()
 		( [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] )
 }
 
+hvf_available ()
+{
+	[ "$(sysctl -n kern.hv_support 2>/dev/null)" = "1" ] || return 1
+	[ "$HOST" = "$ARCH_NAME" ] ||
+		( [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] )
+}
+
 get_qemu_accelerator ()
 {
 	if [ "$ACCEL" = "kvm" ] && ! kvm_available; then
 		echo "KVM is needed, but not available on this host" >&2
 		return 2
 	fi
+	if [ "$ACCEL" = "hvf" ] && ! hvf_available; then
+		echo "HVF is needed, but not available on this host" >&2
+		return 2
+	fi
 
 	if [ "$ACCEL" ]; then
 		echo $ACCEL
 	elif kvm_available; then
 		echo kvm
+	elif hvf_available; then
+		echo hvf
 	else
 		echo tcg
 	fi
-- 
2.24.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux