summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2018-07-11 13:19:42 +0000
committermlarkin <mlarkin@openbsd.org>2018-07-11 13:19:42 +0000
commit8fd32492d7ddfeb5ad82d89e52cc9d634406e5f6 (patch)
tree7c3beb1d6244803fbf13e31161aed6195562d315
parentRetire RTM_LOSING, it no longer makes sense and on busy servers the (diff)
downloadwireguard-openbsd-8fd32492d7ddfeb5ad82d89e52cc9d634406e5f6.tar.xz
wireguard-openbsd-8fd32492d7ddfeb5ad82d89e52cc9d634406e5f6.zip
vmm(4): return proper cache topology for cpuid(0x4)
Make the cache neighbor fields match the number of VCPUs present (currently 1) ok reyk
-rw-r--r--sys/arch/amd64/amd64/vmm.c6
-rw-r--r--sys/arch/amd64/include/vmmvar.h7
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 6dc20d5545c..a5f780be96a 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.212 2018/07/11 12:55:01 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.213 2018/07/11 13:19:42 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -5988,13 +5988,13 @@ vmm_handle_cpuid(struct vcpu *vcpu)
break;
case 0x04: /* Deterministic cache info */
if (*rcx == 0) {
- *rax = eax;
+ *rax = eax & VMM_CPUID4_CACHE_TOPOLOGY_MASK;
*rbx = ebx;
*rcx = ecx;
*rdx = edx;
} else {
CPUID_LEAF(*rax, *rcx, eax, ebx, ecx, edx);
- *rax = eax;
+ *rax = eax & VMM_CPUID4_CACHE_TOPOLOGY_MASK;
*rbx = ebx;
*rcx = ecx;
*rdx = edx;
diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h
index 9e3ad9488ad..033bb6e21e8 100644
--- a/sys/arch/amd64/include/vmmvar.h
+++ b/sys/arch/amd64/include/vmmvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmmvar.h,v 1.54 2018/07/05 05:07:03 mlarkin Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.55 2018/07/11 13:19:42 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -609,6 +609,11 @@ struct vm_rwregs_params {
*/
#define VMM_FEAT_EFLAGS_MASK ~(CPUID_RDTSCP)
+/*
+ * CPUID[0x4] deterministic cache info
+ */
+#define VMM_CPUID4_CACHE_TOPOLOGY_MASK 0x3FF
+
#ifdef _KERNEL
#define VMX_FAIL_LAUNCH_UNKNOWN 1