git: f9857ea43a38 - stable/14 - bhyve: fix CPUID L3 Cache Size reporting for AMD/SVM
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Mar 2025 00:25:23 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=f9857ea43a38b74e34ce7f6576ad4e6415413454
commit f9857ea43a38b74e34ce7f6576ad4e6415413454
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-12-17 21:09:33 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-03-12 00:25:02 +0000
bhyve: fix CPUID L3 Cache Size reporting for AMD/SVM
PR: 279901
(cherry picked from commit 0698ce429f78f548f7eb3e54476fb312109ddd8b)
---
sys/amd64/vmm/x86.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 7d11346ac842..744e2bfd57db 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -152,8 +152,6 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
* pkg_id_shift and other OSes may rely on it.
*/
width = MIN(0xF, log2(threads * cores));
- if (width < 0x4)
- width = 0;
logical_cpus = MIN(0xFF, threads * cores - 1);
regs[2] = (width << AMDID_COREID_SIZE_SHIFT) | logical_cpus;
}
@@ -258,7 +256,7 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
func = 3; /* unified cache */
break;
default:
- logical_cpus = 0;
+ logical_cpus = sockets * threads * cores;
level = 0;
func = 0;
break;
@@ -268,7 +266,14 @@ x86_emulate_cpuid(struct vcpu *vcpu, uint64_t *rax, uint64_t *rbx,
regs[0] = (logical_cpus << 14) | (1 << 8) |
(level << 5) | func;
regs[1] = (func > 0) ? (CACHE_LINE_SIZE - 1) : 0;
+
+ /*
+ * ecx: Number of cache ways for non-fully
+ * associative cache, minus 1. Reported value
+ * of zero means there is one way.
+ */
regs[2] = 0;
+
regs[3] = 0;
break;