[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 41/50] i386/cpu/hyperv: support over 64 vcpus for win
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 41/50] i386/cpu/hyperv: support over 64 vcpus for windows guests |
Date: |
Tue, 19 Sep 2017 14:29:30 +0200 |
From: Gonglei <address@hidden>
Starting with Windows Server 2012 and Windows 8, if
CPUID.40000005.EAX contains a value of -1, Windows assumes specific
limit to the number of VPs. In this case, Windows Server 2012
guest VMs may use more than 64 VPs, up to the maximum supported
number of processors applicable to the specific Windows
version being used.
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
For compatibility, Let's introduce a new property for X86CPU,
named "x-hv-max-vps" as Eduardo's suggestion, and set it
to 0x40 before machine 2.10.
(The "x-" prefix indicates that the property is not supposed to
be a stable user interface.)
Signed-off-by: Gonglei <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/hw/i386/pc.h | 5 +++++
target/i386/cpu.c | 14 ++++++++++++++
target/i386/cpu.h | 2 ++
target/i386/kvm.c | 3 ++-
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8226904..087d184 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -371,6 +371,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_10 \
HW_COMPAT_2_10 \
+ {\
+ .driver = TYPE_X86_CPU,\
+ .property = "x-hv-max-vps",\
+ .value = "0x40",\
+ },
#define PC_COMPAT_2_9 \
HW_COMPAT_2_9 \
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 7644f6d..40c3091 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4145,6 +4145,20 @@ static Property x86_cpu_properties[] = {
false),
DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true),
DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
+
+ /*
+ * From "Requirements for Implementing the Microsoft
+ * Hypervisor Interface":
+ *
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
+ *
+ * "Starting with Windows Server 2012 and Windows 8, if
+ * CPUID.40000005.EAX contains a value of -1, Windows assumes that
+ * the hypervisor imposes no specific limit to the number of VPs.
+ * In this case, Windows Server 2012 guest VMs may use more than
+ * 64 VPs, up to the maximum supported number of processors applicable
+ * to the specific Windows version being used."
+ */
+ DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
DEFINE_PROP_END_OF_LIST()
};
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 525d35d..5c726f3 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1282,6 +1282,8 @@ struct X86CPU {
int32_t socket_id;
int32_t core_id;
int32_t thread_id;
+
+ int32_t hv_max_vps;
};
static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 739334a..ee4e91f 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -786,7 +786,8 @@ int kvm_arch_init_vcpu(CPUState *cs)
c = &cpuid_data.entries[cpuid_i++];
c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
- c->eax = 0x40;
+
+ c->eax = cpu->hv_max_vps;
c->ebx = 0x40;
kvm_base = KVM_CPUID_SIGNATURE_NEXT;
--
1.8.3.1
- [Qemu-devel] [PULL 33/50] hw/i386: Improve some of the warning messages, (continued)
- [Qemu-devel] [PULL 33/50] hw/i386: Improve some of the warning messages, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 35/50] Convert single line fprintf(.../n) to warn_report(), Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 38/50] target/mips: Convert VM clock update prints to warn_report, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 36/50] Convert multi-line fprintf() to warn_report(), Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 34/50] Convert remaining error_report() to warn_report(), Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 42/50] hyperv: add header with protocol definitions, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 37/50] General warn report fixups, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 43/50] update-linux-headers: prepare for hyperv.h removal, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 41/50] i386/cpu/hyperv: support over 64 vcpus for windows guests,
Paolo Bonzini <=
- [Qemu-devel] [PULL 45/50] target/i386: fix "info mem" for LA57 mode, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 39/50] Makefile: Remove libqemustub.a, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 40/50] Convert remaining single line fprintf() to warn_report(), Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 44/50] scripts: let checkpatch.pl process an entire GIT branch, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 48/50] osdep.h: Prohibit disabling assert() in supported builds, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 46/50] accel/hax: move hax-stub.c to accel/stubs/, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 50/50] docker: fix creation of archives, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 47/50] checkpatch: add hwaddr to @typeList, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 49/50] default-configs: Replace $(and ...) with $(call land, ...), Paolo Bonzini, 2017/09/19