Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress unimplemented MSR related warnings #1611

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions usr.sbin/bhyve/amd64/bhyverun_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ bhyve_init_config(void)
set_config_bool("acpi_tables_in_memory", true);
set_config_value("memory.size", "256M");
set_config_bool("x86.strictmsr", true);
set_config_bool("x86.verbosemsr", false);
set_config_value("lpc.fwcfg", "bhyve");
}

Expand Down
12 changes: 8 additions & 4 deletions usr.sbin/bhyve/amd64/vmexit.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ vmexit_rdmsr(struct vmctx *ctx __unused, struct vcpu *vcpu,
val = 0;
error = emulate_rdmsr(vcpu, vme->u.msr.code, &val);
if (error != 0) {
EPRINTLN("rdmsr to register %#x on vcpu %d",
vme->u.msr.code, vcpu_id(vcpu));
if (get_config_bool("x86.strictmsr") || get_config_bool("x86.verbosemsr")) {
EPRINTLN("rdmsr to register %#x on vcpu %d",
vme->u.msr.code, vcpu_id(vcpu));
}
if (get_config_bool("x86.strictmsr")) {
vm_inject_gp(vcpu);
return (VMEXIT_CONTINUE);
Expand Down Expand Up @@ -137,8 +139,10 @@ vmexit_wrmsr(struct vmctx *ctx __unused, struct vcpu *vcpu,

error = emulate_wrmsr(vcpu, vme->u.msr.code, vme->u.msr.wval);
if (error != 0) {
EPRINTLN("wrmsr to register %#x(%#lx) on vcpu %d",
vme->u.msr.code, vme->u.msr.wval, vcpu_id(vcpu));
if (get_config_bool("x86.strictmsr") || get_config_bool("x86.verbosemsr")) {
EPRINTLN("wrmsr to register %#x(%#lx) on vcpu %d",
vme->u.msr.code, vme->u.msr.wval, vcpu_id(vcpu));
}
if (get_config_bool("x86.strictmsr")) {
vm_inject_gp(vcpu);
return (VMEXIT_CONTINUE);
Expand Down
5 changes: 5 additions & 0 deletions usr.sbin/bhyve/bhyve_config.5
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ By default, writes are ignored and reads return all bits set.
Inject a general protection fault if a guest accesses a Model Specific
Register (MSR) that is not emulated.
If this is false, writes are ignored and reads return zero.
.It Va x86.verbosemsr Ta bool Ta false Ta
Enable verbose MSR print out. When this option is true,
messages related to reading from (rdmsr) and writing to (wrmsr)
MSRs on virtual CPUs will be printed out. This can be useful for
debugging purposes.
.It Va x86.vmexit_on_hlt Ta bool Ta false Ta
Force a VM exit when a guest CPU executes the
.Dv HLT
Expand Down