Page MenuHomeFreeBSD

map capability string for VM_CAP_BPT_EXIT
ClosedPublic

Authored by rew on Apr 4 2020, 2:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 26, 5:34 PM
Unknown Object (File)
Wed, Sep 17, 4:50 AM
Unknown Object (File)
Aug 26 2025, 4:04 AM
Unknown Object (File)
Aug 20 2025, 4:18 AM
Unknown Object (File)
Aug 12 2025, 10:50 AM
Unknown Object (File)
Aug 5 2025, 9:00 PM
Unknown Object (File)
Jul 7 2025, 1:15 PM
Unknown Object (File)
Jul 6 2025, 9:43 PM
Subscribers

Details

Summary

This patch adds a descriptive string for mapping to the VM_CAP_BPT_EXIT.
I noticed this when using bhyvectl to identify the vmm capabilities.

Test Plan

without patch:

$ bhyvectl --vm vm --getcap
Capability "hlt_exit" is set on vcpu 0
Capability "mtrap_exit" is not available
Capability "pause_exit" is set on vcpu 0
Capability "unrestricted_guest" is set on vcpu 0
Capability "enable_invpcid" is not available
Capability "(null)" is not available

with patch:

$ bhyvectl --vm vm --getcap
Capability "hlt_exit" is set on vcpu 0
Capability "mtrap_exit" is not available
Capability "pause_exit" is set on vcpu 0
Capability "unrestricted_guest" is set on vcpu 0
Capability "enable_invpcid" is not available
Capability "bpt_exit" is not available

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 30339
Build 28107: arc lint + arc unit

Event Timeline

Looks like this was missed in commit rS355724 for review D20309.

This revision is now accepted and ready to land.Apr 4 2020, 8:47 AM

BTW, I would suggest replacing this structure with one indexed by the enum values and using nitems() and C99 initializers as a followup change, e.g.:

static const char *capstrmap[] = {
   [VM_CAP_HALT_EXIT] = "hlt_exit",
   ...
};

const char *
vm_capability_type2name(int type)
{
    if (type < nitems(capstrmap))
        return (capstrmap[type]);
    else
        return (NULL);
}

vm_capability_name2type would still have to do a loop, but would use`'i < nitems(capstrmap)` as the terminating condition for the loop.

Updating D24289: map capability string for VM_CAP_BPT_EXIT

John, per your suggestion.

capstrmap is now indexed by enum vm_cap_type.

This revision now requires review to proceed.Apr 7 2020, 3:45 PM
This revision is now accepted and ready to land.Apr 7 2020, 10:58 PM
This revision was automatically updated to reflect the committed changes.