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)
Wed, Nov 13, 11:28 AM
Unknown Object (File)
Sun, Nov 10, 2:50 AM
Unknown Object (File)
Oct 1 2024, 4:10 PM
Unknown Object (File)
Sep 25 2024, 7:29 PM
Unknown Object (File)
Sep 25 2024, 6:54 PM
Unknown Object (File)
Sep 13 2024, 10:28 AM
Unknown Object (File)
Sep 13 2024, 10:28 AM
Unknown Object (File)
Sep 13 2024, 10:28 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.