diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2018-07-11 13:19:43 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2018-07-11 13:19:43 +0000 |
commit | 64023a9a5ca6c9d8e91b62e58ba084396cdbccff (patch) | |
tree | 589138b4b2d596931ce31a6b296eb4dcc20f1bfa /sys/arch | |
parent | 11bea989279a2b6b2caab39b36c5d2aaf0a55e7b (diff) |
vmm(4): return proper cache topology for cpuid(0x4)
Make the cache neighbor fields match the number of VCPUs present
(currently 1)
ok reyk
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/include/vmmvar.h | 7 |
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 |