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)
Tue, May 21, 9:13 AM
Unknown Object (File)
Thu, Apr 25, 5:01 PM
Unknown Object (File)
Thu, Apr 25, 5:00 PM
Unknown Object (File)
Thu, Apr 25, 5:00 PM
Unknown Object (File)
Apr 22 2024, 11:12 AM
Unknown Object (File)
Apr 14 2024, 1:46 AM
Unknown Object (File)
Apr 14 2024, 1:39 AM
Unknown Object (File)
Apr 1 2024, 4:17 AM
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 Skipped
Unit
No Test Coverage
Build Status
Buildable 30279
Build 28055: 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.