[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 18/19] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENT
From: |
Vitaly Kuznetsov |
Subject: |
[PATCH v6 18/19] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS priviliges |
Date: |
Thu, 22 Apr 2021 18:11:29 +0200 |
When Hyper-V SynIC has its QEMU part enabled (no 'x-hv-synic-kvm-only'),
we may need to allow Windows guest to make hypercalls (POST_MESSAGES/
SIGNAL_EVENTS). No issue is currently observed because KVM is very
permissive, allowing these hypercalls regarding of guest visible CPUid
bits.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
target/i386/kvm/hyperv-proto.h | 6 ++++++
target/i386/kvm/kvm.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/target/i386/kvm/hyperv-proto.h b/target/i386/kvm/hyperv-proto.h
index e30d64b4ade4..5fbb385cc136 100644
--- a/target/i386/kvm/hyperv-proto.h
+++ b/target/i386/kvm/hyperv-proto.h
@@ -38,6 +38,12 @@
#define HV_ACCESS_FREQUENCY_MSRS (1u << 11)
#define HV_ACCESS_REENLIGHTENMENTS_CONTROL (1u << 13)
+/*
+ * HV_CPUID_FEATURES.EBX bits
+ */
+#define HV_POST_MESSAGES (1u << 4)
+#define HV_SIGNAL_EVENTS (1u << 5)
+
/*
* HV_CPUID_FEATURES.EDX bits
*/
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index d81451276cd8..88c64909a2ff 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1341,6 +1341,11 @@ static int hyperv_fill_cpuids(CPUState *cs,
c->ebx = hv_build_cpuid_leaf(cs, HV_CPUID_FEATURES, R_EBX);
c->edx = hv_build_cpuid_leaf(cs, HV_CPUID_FEATURES, R_EDX);
+ /* In-QEMU SynIC and Vmbus devices require messages/signals hypercalls */
+ if (!cpu->hyperv_synic_kvm_only) {
+ c->ebx |= HV_POST_MESSAGES | HV_SIGNAL_EVENTS;
+ }
+
/* Not exposed by KVM but needed to make CPU hotplug in Windows work */
c->edx |= HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE;
--
2.30.2
- [PATCH v6 04/19] i386: stop using env->features[] for filling Hyper-V CPUIDs, (continued)
- [PATCH v6 04/19] i386: stop using env->features[] for filling Hyper-V CPUIDs, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 06/19] i386: introduce hv_cpuid_get_host(), Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 05/19] i386: introduce hyperv_feature_supported(), Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 07/19] i386: drop FEAT_HYPERV feature leaves, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 08/19] i386: introduce hv_cpuid_cache, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 11/19] i386: switch hyperv_expand_features() to using error_setg(), Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 09/19] i386: split hyperv_handle_properties() into hyperv_expand_features()/hyperv_fill_cpuids(), Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 17/19] i386: HV_HYPERCALL_AVAILABLE privilege bit is always needed, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 10/19] i386: move eVMCS enablement to hyperv_init_vcpu(), Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 16/19] i386: kill off hv_cpuid_check_and_set(), Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 18/19] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS priviliges,
Vitaly Kuznetsov <=
- [PATCH v6 19/19] qtest/hyperv: Introduce a simple hyper-v test, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 12/19] i386: adjust the expected KVM_GET_SUPPORTED_HV_CPUID array size, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 13/19] i386: prefer system KVM_GET_SUPPORTED_HV_CPUID ioctl over vCPU's one, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 15/19] i386: expand Hyper-V features during CPU feature expansion time, Vitaly Kuznetsov, 2021/04/22
- [PATCH v6 14/19] i386: use global kvm_state in hyperv_enabled() check, Vitaly Kuznetsov, 2021/04/22