Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyvectl/bhyvectl.c
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | usage(bool cpu_intel) | ||||
" [--set-exception-bitmap]\n" | " [--set-exception-bitmap]\n" | ||||
" [--get-exception-bitmap]\n" | " [--get-exception-bitmap]\n" | ||||
" [--get-tsc-offset]\n" | " [--get-tsc-offset]\n" | ||||
" [--get-guest-pat]\n" | " [--get-guest-pat]\n" | ||||
" [--get-io-bitmap-address]\n" | " [--get-io-bitmap-address]\n" | ||||
" [--get-msr-bitmap]\n" | " [--get-msr-bitmap]\n" | ||||
" [--get-msr-bitmap-address]\n" | " [--get-msr-bitmap-address]\n" | ||||
" [--get-guest-sysenter]\n" | " [--get-guest-sysenter]\n" | ||||
" [--get-exit-reason]\n", | " [--get-exit-reason]\n" | ||||
" [--get-cpu-topology]\n", | |||||
progname); | progname); | ||||
if (cpu_intel) { | if (cpu_intel) { | ||||
(void)fprintf(stderr, | (void)fprintf(stderr, | ||||
" [--get-vmcs-pinbased-ctls]\n" | " [--get-vmcs-pinbased-ctls]\n" | ||||
" [--get-vmcs-procbased-ctls]\n" | " [--get-vmcs-procbased-ctls]\n" | ||||
" [--get-vmcs-procbased-ctls2]\n" | " [--get-vmcs-procbased-ctls2]\n" | ||||
" [--get-vmcs-entry-interruption-info]\n" | " [--get-vmcs-entry-interruption-info]\n" | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
static int set_desc_tr, get_desc_tr; | static int set_desc_tr, get_desc_tr; | ||||
static int set_desc_ldtr, get_desc_ldtr; | static int set_desc_ldtr, get_desc_ldtr; | ||||
static int set_cs, set_ds, set_es, set_fs, set_gs, set_ss, set_tr, set_ldtr; | static int set_cs, set_ds, set_es, set_fs, set_gs, set_ss, set_tr, set_ldtr; | ||||
static int get_cs, get_ds, get_es, get_fs, get_gs, get_ss, get_tr, get_ldtr; | static int get_cs, get_ds, get_es, get_fs, get_gs, get_ss, get_tr, get_ldtr; | ||||
static int set_x2apic_state, get_x2apic_state; | static int set_x2apic_state, get_x2apic_state; | ||||
enum x2apic_state x2apic_state; | enum x2apic_state x2apic_state; | ||||
static int unassign_pptdev, bus, slot, func; | static int unassign_pptdev, bus, slot, func; | ||||
static int run; | static int run; | ||||
static int get_cpu_topology; | |||||
/* | /* | ||||
* VMCB specific. | * VMCB specific. | ||||
*/ | */ | ||||
static int get_vmcb_intercept, get_vmcb_exit_details, get_vmcb_tlb_ctrl; | static int get_vmcb_intercept, get_vmcb_exit_details, get_vmcb_tlb_ctrl; | ||||
static int get_vmcb_virq, get_avic_table; | static int get_vmcb_virq, get_avic_table; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 1,155 Lines • ▼ Show 20 Lines | const struct option common_opts[] = { | ||||
{ "create", NO_ARG, &create, 1 }, | { "create", NO_ARG, &create, 1 }, | ||||
{ "destroy", NO_ARG, &destroy, 1 }, | { "destroy", NO_ARG, &destroy, 1 }, | ||||
{ "inject-nmi", NO_ARG, &inject_nmi, 1 }, | { "inject-nmi", NO_ARG, &inject_nmi, 1 }, | ||||
{ "force-reset", NO_ARG, &force_reset, 1 }, | { "force-reset", NO_ARG, &force_reset, 1 }, | ||||
{ "force-poweroff", NO_ARG, &force_poweroff, 1 }, | { "force-poweroff", NO_ARG, &force_poweroff, 1 }, | ||||
{ "get-active-cpus", NO_ARG, &get_active_cpus, 1 }, | { "get-active-cpus", NO_ARG, &get_active_cpus, 1 }, | ||||
{ "get-suspended-cpus", NO_ARG, &get_suspended_cpus, 1 }, | { "get-suspended-cpus", NO_ARG, &get_suspended_cpus, 1 }, | ||||
{ "get-intinfo", NO_ARG, &get_intinfo, 1 }, | { "get-intinfo", NO_ARG, &get_intinfo, 1 }, | ||||
{ "get-cpu-topology", NO_ARG, &get_cpu_topology, 1 }, | |||||
}; | }; | ||||
const struct option intel_opts[] = { | const struct option intel_opts[] = { | ||||
{ "get-vmcs-pinbased-ctls", | { "get-vmcs-pinbased-ctls", | ||||
NO_ARG, &get_pinbased_ctls, 1 }, | NO_ARG, &get_pinbased_ctls, 1 }, | ||||
{ "get-vmcs-procbased-ctls", | { "get-vmcs-procbased-ctls", | ||||
NO_ARG, &get_procbased_ctls, 1 }, | NO_ARG, &get_procbased_ctls, 1 }, | ||||
{ "get-vmcs-procbased-ctls2", | { "get-vmcs-procbased-ctls2", | ||||
▲ Show 20 Lines • Show All 838 Lines • ▼ Show 20 Lines | if (!error && (get_stats || get_all)) { | ||||
stats = vm_get_stats(ctx, vcpu, &tv, &num_stats); | stats = vm_get_stats(ctx, vcpu, &tv, &num_stats); | ||||
if (stats != NULL) { | if (stats != NULL) { | ||||
printf("vcpu%d stats:\n", vcpu); | printf("vcpu%d stats:\n", vcpu); | ||||
for (i = 0; i < num_stats; i++) { | for (i = 0; i < num_stats; i++) { | ||||
desc = vm_get_stat_desc(ctx, i); | desc = vm_get_stat_desc(ctx, i); | ||||
printf("%-40s\t%ld\n", desc, stats[i]); | printf("%-40s\t%ld\n", desc, stats[i]); | ||||
} | } | ||||
} | } | ||||
} | |||||
if (!error && (get_cpu_topology || get_all)) { | |||||
uint16_t sockets, cores, threads, maxcpus; | |||||
vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus); | |||||
printf("cpu_topology:\tsockets=%hu, cores=%hu, threads=%hu, " | |||||
"maxcpus=%hu\n", sockets, cores, threads, maxcpus); | |||||
} | } | ||||
if (!error && run) { | if (!error && run) { | ||||
error = vm_run(ctx, vcpu, &vmexit); | error = vm_run(ctx, vcpu, &vmexit); | ||||
if (error == 0) | if (error == 0) | ||||
dump_vm_run_exitcode(&vmexit, vcpu); | dump_vm_run_exitcode(&vmexit, vcpu); | ||||
else | else | ||||
printf("vm_run error %d\n", error); | printf("vm_run error %d\n", error); | ||||
Show All 17 Lines |