From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: [Qemu-devel] [PULL 11/25] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers
Date: Fri, 21 Jun 2019 03:42:16 +0200 [thread overview]
Message-ID: <1561081350-3723-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1561081350-3723-1-git-send-email-pbonzini@redhat.com>
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Hyper-V on KVM can only use Synthetic timers with Direct Mode (opting for
an interrupt instead of VMBus message). This new capability is only
announced in KVM_GET_SUPPORTED_HV_CPUID.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20190517141924.19024-10-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/hyperv.txt | 10 ++++++++++
target/i386/cpu.c | 2 ++
target/i386/cpu.h | 1 +
target/i386/hyperv-proto.h | 1 +
target/i386/kvm.c | 9 +++++++++
5 files changed, 23 insertions(+)
diff --git a/docs/hyperv.txt b/docs/hyperv.txt
index beadb2d..8fdf25c 100644
--- a/docs/hyperv.txt
+++ b/docs/hyperv.txt
@@ -174,6 +174,16 @@ without the feature to find out if enabling it is beneficial.
Requires: hv-vapic
+3.17. hv-stimer-direct
+=======================
+Hyper-V specification allows synthetic timer operation in two modes: "classic",
+when expiration event is delivered as SynIC message and "direct", when the event
+is delivered via normal interrupt. It is known that nested Hyper-V can only
+use synthetic timers in direct mode and thus 'hv-stimer-direct' needs to be
+enabled.
+
+Requires: hv-vpindex, hv-synic, hv-time, hv-stimer
+
4. Development features
========================
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e07996c..7beb8ab 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5883,6 +5883,8 @@ static Property x86_cpu_properties[] = {
HYPERV_FEAT_EVMCS, 0),
DEFINE_PROP_BIT64("hv-ipi", X86CPU, hyperv_features,
HYPERV_FEAT_IPI, 0),
+ DEFINE_PROP_BIT64("hv-stimer-direct", X86CPU, hyperv_features,
+ HYPERV_FEAT_STIMER_DIRECT, 0),
DEFINE_PROP_BOOL("hv-passthrough", X86CPU, hyperv_passthrough, false),
DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true),
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 86edbf5..7470acf 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -749,6 +749,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
#define HYPERV_FEAT_TLBFLUSH 11
#define HYPERV_FEAT_EVMCS 12
#define HYPERV_FEAT_IPI 13
+#define HYPERV_FEAT_STIMER_DIRECT 14
#ifndef HYPERV_SPINLOCK_NEVER_RETRY
#define HYPERV_SPINLOCK_NEVER_RETRY 0xFFFFFFFF
diff --git a/target/i386/hyperv-proto.h b/target/i386/hyperv-proto.h
index c0272b3..cffac10 100644
--- a/target/i386/hyperv-proto.h
+++ b/target/i386/hyperv-proto.h
@@ -49,6 +49,7 @@
#define HV_GUEST_IDLE_STATE_AVAILABLE (1u << 5)
#define HV_FREQUENCY_MSRS_AVAILABLE (1u << 8)
#define HV_GUEST_CRASH_MSR_AVAILABLE (1u << 10)
+#define HV_STIMER_DIRECT_MODE_AVAILABLE (1u << 19)
/*
* HV_CPUID_ENLIGHTMENT_INFO.EAX bits
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 86de510..a323b1f 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -802,6 +802,14 @@ static struct {
},
.dependencies = BIT(HYPERV_FEAT_VPINDEX)
},
+ [HYPERV_FEAT_STIMER_DIRECT] = {
+ .desc = "direct mode synthetic timers (hv-stimer-direct)",
+ .flags = {
+ {.fw = FEAT_HYPERV_EDX,
+ .bits = HV_STIMER_DIRECT_MODE_AVAILABLE}
+ },
+ .dependencies = BIT(HYPERV_FEAT_STIMER)
+ },
};
static struct kvm_cpuid2 *try_get_hv_cpuid(CPUState *cs, int max)
@@ -1124,6 +1132,7 @@ static int hyperv_handle_properties(CPUState *cs,
r |= hv_cpuid_check_and_set(cs, cpuid, HYPERV_FEAT_TLBFLUSH);
r |= hv_cpuid_check_and_set(cs, cpuid, HYPERV_FEAT_EVMCS);
r |= hv_cpuid_check_and_set(cs, cpuid, HYPERV_FEAT_IPI);
+ r |= hv_cpuid_check_and_set(cs, cpuid, HYPERV_FEAT_STIMER_DIRECT);
/* Additional dependencies not covered by kvm_hyperv_properties[] */
if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC) &&
--
1.8.3.1
next prev parent reply other threads:[~2019-06-21 2:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 1:42 [Qemu-devel] [PULL 00/25] Misc (mostly x86) patches for 2019-06-21 Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 01/25] kvm-all: Add/update fprintf's for kvm_*_ioeventfd_del Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 02/25] hax: Honor CPUState::halted Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 03/25] i386/kvm: convert hyperv enlightenments properties from bools to bits Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 04/25] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 05/25] i386/kvm: move Hyper-V CPUID filling to hyperv_handle_properties() Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 06/25] i386/kvm: document existing Hyper-V enlightenments Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 07/25] i386/kvm: implement 'hv-passthrough' mode Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 08/25] i386/kvm: hv-stimer requires hv-time and hv-synic Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 09/25] i386/kvm: hv-tlbflush/ipi require hv-vpindex Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 10/25] i386/kvm: hv-evmcs requires hv-vapic Paolo Bonzini
2019-06-21 1:42 ` Paolo Bonzini [this message]
2019-06-21 1:42 ` [Qemu-devel] [PULL 12/25] target/i386: define a new MSR based feature word - FEAT_CORE_CAPABILITY Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 13/25] target/i386: kvm: Delete VMX migration blocker on vCPU init failure Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 14/25] KVM: Introduce kvm_arch_destroy_vcpu() Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 15/25] target/i386: kvm: Use symbolic constant for #DB/#BP exception constants Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 16/25] target/i386: kvm: Re-inject #DB to guest with updated DR6 Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 17/25] target/i386: kvm: Block migration for vCPUs exposed with nested virtualization Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 18/25] linux-headers: sync with latest KVM headers from Linux 5.2 Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 19/25] vmstate: Add support for kernel integer types Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 21/25] target/i386: kvm: Add support for KVM_CAP_EXCEPTION_PAYLOAD Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 22/25] target/i386: kvm: Add nested migration blocker only when kernel lacks required capabilities Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 23/25] sd: Fix out-of-bounds assertions Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 24/25] util/main-loop: Fix incorrect assertion Paolo Bonzini
2019-06-21 1:42 ` [Qemu-devel] [PULL 25/25] hw: Nuke hw_compat_4_0_1 and pc_compat_4_0_1 Paolo Bonzini
2019-06-21 2:30 ` [Qemu-devel] [PULL 00/25] Misc (mostly x86) patches for 2019-06-21 no-reply
2019-06-21 11:38 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2019-06-21 11:29 [Qemu-devel] [PULL v2 " Paolo Bonzini
2019-06-21 11:30 ` [Qemu-devel] [PULL 11/25] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers Paolo Bonzini
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=1561081350-3723-12-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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).