From: mlarkin Date: Wed, 11 Jul 2018 13:19:42 +0000 (+0000) Subject: vmm(4): return proper cache topology for cpuid(0x4) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8fd32492d7ddfeb5ad82d89e52cc9d634406e5f6;p=openbsd vmm(4): return proper cache topology for cpuid(0x4) Make the cache neighbor fields match the number of VCPUs present (currently 1) ok reyk --- 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 * @@ -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 * @@ -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