git: 5d32d1c77379 - main - libvmmapi/amd64: Add support for CPUID ioctls to libvmmapi
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Nov 2026 21:35:57 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=5d32d1c77379c6f721de9068fe4682481f479b42
commit 5d32d1c77379c6f721de9068fe4682481f479b42
Author: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
AuthorDate: 2025-07-01 15:58:55 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-25 21:29:07 +0000
libvmmapi/amd64: Add support for CPUID ioctls to libvmmapi
libvmmapi needs wrapper functions for the new vmm/amd64 CPUID ioctls.
Reviewed by: corvink, markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51554
---
lib/libvmmapi/amd64/vmmapi_machdep.c | 33 +++++++++++++++++++++++++++++++++
lib/libvmmapi/vmmapi.h | 4 +++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/lib/libvmmapi/amd64/vmmapi_machdep.c b/lib/libvmmapi/amd64/vmmapi_machdep.c
index 806c31abf426..b1d68274428a 100644
--- a/lib/libvmmapi/amd64/vmmapi_machdep.c
+++ b/lib/libvmmapi/amd64/vmmapi_machdep.c
@@ -71,6 +71,9 @@ const char *vm_capstrmap[] = {
VM_ISA_PULSE_IRQ, \
VM_ISA_SET_IRQ_TRIGGER, \
VM_INJECT_NMI, \
+ VM_GET_CPUID, \
+ VM_SET_CPUID, \
+ VM_LEGACY_CPUID, \
VM_SET_X2APIC_STATE, \
VM_GET_X2APIC_STATE, \
VM_GET_HPET_CAPABILITIES, \
@@ -348,6 +351,36 @@ vm_set_x2apic_state(struct vcpu *vcpu, enum x2apic_state state)
return (error);
}
+int
+vm_get_cpuid(struct vcpu *vcpu, struct vm_vcpu_cpuid_config *cfg)
+{
+ int error;
+
+ error = vcpu_ioctl(vcpu, VM_GET_CPUID, cfg);
+
+ return (error);
+}
+
+int
+vm_set_cpuid(struct vcpu *vcpu, struct vm_vcpu_cpuid_config *cfg)
+{
+ int error;
+
+ error = vcpu_ioctl(vcpu, VM_SET_CPUID, cfg);
+
+ return (error);
+}
+
+int
+vm_legacy_cpuid(struct vcpu *vcpu, struct vm_legacy_cpuid *vlc)
+{
+ int error;
+
+ error = vcpu_ioctl(vcpu, VM_LEGACY_CPUID, vlc);
+
+ return (error);
+}
+
int
vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities)
{
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index 25dd5021ccdd..bec7ba85a617 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -228,7 +228,9 @@ const char *vm_get_stat_desc(struct vmctx *ctx, int index);
#ifdef __amd64__
int vm_get_x2apic_state(struct vcpu *vcpu, enum x2apic_state *s);
int vm_set_x2apic_state(struct vcpu *vcpu, enum x2apic_state s);
-
+int vm_get_cpuid(struct vcpu *vcpu, struct vm_vcpu_cpuid_config *cfg);
+int vm_set_cpuid(struct vcpu *vcpu, struct vm_vcpu_cpuid_config *cfg);
+int vm_legacy_cpuid(struct vcpu *vcpu, struct vm_legacy_cpuid *vlc);
int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities);
/*