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
F135678227: D24289.diff
Tue, Nov 11, 8:02 PM
Unknown Object (File)
Sun, Nov 9, 4:17 AM
Unknown Object (File)
Mon, Oct 27, 1:58 AM
Unknown Object (File)
Wed, Oct 15, 6:40 PM
Unknown Object (File)
Wed, Oct 15, 6:40 PM
Unknown Object (File)
Wed, Oct 15, 6:40 PM
Unknown Object (File)
Wed, Oct 15, 6:40 PM
Unknown Object (File)
Wed, Oct 15, 8:14 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 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.