linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Kelley <mikelley@microsoft.com>
To: "virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"jgross@suse.com" <jgross@suse.com>,
	"akataria@vmware.com" <akataria@vmware.com>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"apw@canonical.com" <apw@canonical.com>,
	vkuznets <vkuznets@redhat.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com>,
	KY Srinivasan <kys@microsoft.com>
Cc: Michael Kelley <mikelley@microsoft.com>
Subject: [PATCH 1/2] include/linux/hypervisor.h: Add test for running on Hyper-V
Date: Thu, 1 Nov 2018 17:32:04 +0000	[thread overview]
Message-ID: <1541093480-10539-1-git-send-email-mikelley@microsoft.com> (raw)

Add a test for running on Hyper-V on x86/x64.

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
---
 include/linux/hypervisor.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h
index fc08b43..1281f62 100644
--- a/include/linux/hypervisor.h
+++ b/include/linux/hypervisor.h
@@ -9,6 +9,7 @@
 
 #ifdef CONFIG_X86
 
+#include <asm/hypervisor.h>
 #include <asm/jailhouse_para.h>
 #include <asm/x86_init.h>
 
@@ -17,6 +18,11 @@ static inline void hypervisor_pin_vcpu(int cpu)
 	x86_platform.hyper.pin_vcpu(cpu);
 }
 
+static inline bool hypervisor_is_mshyperv(void)
+{
+	return hypervisor_is_type(X86_HYPER_MS_HYPERV);
+}
+
 #else /* !CONFIG_X86 */
 
 #include <linux/of.h>
@@ -30,6 +36,11 @@ static inline bool jailhouse_paravirt(void)
 	return of_find_compatible_node(NULL, NULL, "jailhouse,cell");
 }
 
+static inline bool hypervisor_is_mshyperv(void)
+{
+	return false;
+}
+
 #endif /* !CONFIG_X86 */
 
 #endif /* __LINUX_HYPEVISOR_H */
-- 
1.8.3.1


                 reply	other threads:[~2018-11-01 17:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1541093480-10539-1-git-send-email-mikelley@microsoft.com \
    --to=mikelley@microsoft.com \
    --cc=akataria@vmware.com \
    --cc=apw@canonical.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=jgross@suse.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=olaf@aepfle.de \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vkuznets@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).