Page MenuHomeFreeBSD

bhyvectl/amd64: Add --get-cpuid-cfg
Needs ReviewPublic

Authored by rosenfeld_grumpf.hope-2000.org on Jul 26 2025, 11:25 AM.
Tags
None
Referenced Files
F174200432: D51556.diff
Thu, Oct 1, 8:00 AM
F174188704: D51556.diff
Thu, Oct 1, 6:04 AM
F174134784: D51556.diff
Wed, Sep 30, 8:24 PM
F174105761: D51556.id187995.diff
Wed, Sep 30, 4:20 PM
F174105757: D51556.id164579.diff
Wed, Sep 30, 4:20 PM
F174105752: D51556.id159183.diff
Wed, Sep 30, 4:20 PM
F174105749: D51556.id.diff
Wed, Sep 30, 4:20 PM
Unknown Object (File)
Wed, Sep 30, 1:25 AM

Details

Reviewers
markj
Group Reviewers
bhyve
Summary

Add a command to bhyvectl to fetch and print the CPUID configuration
for a VCPU. The CPUID entries, if any, are printed in hex and ASCII. No
pretty-printing of the information is performed.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77448
Build 74331: arc lint + arc unit

Event Timeline

markj added inline comments.
usr.sbin/bhyvectl/amd64/bhyvectl_machdep.c
1945

Where exactly does it get filled in? This looks like it always queries vcpu 0, ignoring the --cpu parameter.

usr.sbin/bhyvectl/amd64/bhyvectl_machdep.c
1945

This is done in vcpu_ioctl() in vmmapi.c, called by vm_get_cpuid() in vmmapi_machdep.c:

int
vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg)
{
	/*
	 * XXX: fragile, handle with care
	 * Assumes that the first field of the ioctl data
	 * is the vcpuid.
	 */
	*(int *)arg = vcpu->vcpuid;
	return (ioctl(vcpu->ctx->fd, cmd, arg));
}
markj added inline comments.
usr.sbin/bhyvectl/amd64/bhyvectl_machdep.c
1945

Right, I forgot about that bit of magic. (I'd rather initialize vvcc_vcpuid = -1 in that case.)

This revision is now accepted and ready to land.Oct 22 2025, 7:22 PM
rosenfeld_grumpf.hope-2000.org retitled this revision from bhyvectl/amd64: add --get-cpuid-cfg to bhyvectl/amd64: Add --get-cpuid-cfg.Tue, Sep 29, 1:02 PM
This revision now requires review to proceed.Tue, Sep 29, 1:03 PM