public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Roman Bolshakov <r.bolshakov@yadro.com>
To: <kvm@vger.kernel.org>
Cc: Cameron Esfahani <dirty@apple.com>,
	Roman Bolshakov <r.bolshakov@yadro.com>
Subject: [kvm-unit-tests PATCH 1/2] scripts/arch-run: Support testing of hvf accel
Date: Fri, 20 Mar 2020 17:55:40 +0300	[thread overview]
Message-ID: <20200320145541.38578-2-r.bolshakov@yadro.com> (raw)
In-Reply-To: <20200320145541.38578-1-r.bolshakov@yadro.com>

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

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

Cc: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 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


  reply	other threads:[~2020-03-20 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 14:55 [kvm-unit-tests PATCH 0/2] Add support of hvf accel Roman Bolshakov
2020-03-20 14:55 ` Roman Bolshakov [this message]
2020-03-23 22:16   ` [kvm-unit-tests PATCH 1/2] scripts/arch-run: Support testing " Cameron Esfahani
2020-03-20 14:55 ` [kvm-unit-tests PATCH 2/2] README: Document steps to run the tests on macOS Roman Bolshakov
2020-03-23 22:17   ` Cameron Esfahani
2020-03-20 15:37 ` [kvm-unit-tests PATCH 0/2] Add support of hvf accel Roman Bolshakov
2020-03-23 22:18   ` Cameron Esfahani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200320145541.38578-2-r.bolshakov@yadro.com \
    --to=r.bolshakov@yadro.com \
    --cc=dirty@apple.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox