[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/11] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS pr
From: |
Eduardo Habkost |
Subject: |
[PULL 07/11] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS privileges |
Date: |
Tue, 13 Jul 2021 12:09:53 -0400 |
From: Vitaly Kuznetsov <vkuznets@redhat.com>
When Hyper-V SynIC is enabled, we may need to allow Windows guests 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.
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20210608120817.1325125-9-vkuznets@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/i386/kvm/hyperv-proto.h | 6 ++++++
target/i386/kvm/kvm.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/target/i386/kvm/hyperv-proto.h b/target/i386/kvm/hyperv-proto.h
index e30d64b4ade..5fbb385cc13 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 eee1a6b46ea..59ed8327ac1 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1346,6 +1346,12 @@ static int hyperv_fill_cpuids(CPUState *cs,
/* Unconditionally required with any Hyper-V enlightenment */
c->eax |= HV_HYPERCALL_AVAILABLE;
+ /* SynIC and Vmbus devices require messages/signals hypercalls */
+ if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC) &&
+ !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.31.1
- [PULL 00/11] x86 queue, 2021-07-13, Eduardo Habkost, 2021/07/13
- [PULL 03/11] i386: make hyperv_expand_features() return bool, Eduardo Habkost, 2021/07/13
- [PULL 04/11] i386: expand Hyper-V features during CPU feature expansion time, Eduardo Habkost, 2021/07/13
- [PULL 05/11] i386: kill off hv_cpuid_check_and_set(), Eduardo Habkost, 2021/07/13
- [PULL 01/11] i386: clarify 'hv-passthrough' behavior, Eduardo Habkost, 2021/07/13
- [PULL 06/11] i386: HV_HYPERCALL_AVAILABLE privilege bit is always needed, Eduardo Habkost, 2021/07/13
- [PULL 07/11] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS privileges,
Eduardo Habkost <=
- [PULL 10/11] numa: Report expected initiator, Eduardo Habkost, 2021/07/13
- [PULL 11/11] numa: Parse initiator= attribute before cpus= attribute, Eduardo Habkost, 2021/07/13
- [PULL 02/11] i386: hardcode supported eVMCS version to '1', Eduardo Habkost, 2021/07/13
- [PULL 08/11] target/i386: suppress CPUID leaves not defined by the CPU vendor, Eduardo Habkost, 2021/07/13
- [PULL 09/11] target/i386: Fix cpuid level for AMD, Eduardo Habkost, 2021/07/13
- Re: [PULL 00/11] x86 queue, 2021-07-13, Peter Maydell, 2021/07/14