bhyve: implement ignore unknown MSRs feature

Implement the MSRs ignore unknown reads and writes feature
that's specified using:

  <features>
    ...
    <msrs unknown='ignore'>
    ...
  </features>

in the domain XML.

In bhyve, it's just passing '-w' command line argument to the bhyve(8)
executable.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Roman Bogorodskiy 2019-01-25 19:27:58 +04:00
parent b71de701b8
commit e9528f41c6
8 changed files with 91 additions and 0 deletions

View File

@ -2010,6 +2010,7 @@
&lt;tlbflush state='on'/&gt;
&lt;ipi state='on'/&gt;
&lt;evmcs state='on'/&gt;
&lt;msrs unknown='ignore'/&gt;
&lt;/hyperv&gt;
&lt;kvm&gt;
&lt;hidden state='on'/&gt;
@ -2307,6 +2308,15 @@
defined, the hypervisor default will be used.
<span class="since">Since 4.10.0</span> (QEMU/KVM only)
</dd>
<dt><code>msrs</code></dt>
<dd>Some guests might require ignoring unknown
Model Specific Registers (MSRs) reads and writes. It's possible
to switch this by setting <code>unknown</code> attribute
of <code>msrs</code> to <code>ignore</code>. If the attribute is
not defined, or set to <code>fault</code>, unknown reads and writes
will not be ignored.
<span class="since">Since 5.1.0</span> (bhyve only)
</dd>
</dl>
<h3><a id="elementsTime">Time keeping</a></h3>

View File

@ -506,6 +506,10 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
virCommandAddArg(cmd, "-A"); /* Create an ACPI table */
if (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)
virCommandAddArg(cmd, "-I"); /* Present ioapic to the guest */
if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) {
if (def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] == VIR_DOMAIN_MSRS_UNKNOWN_IGNORE)
virCommandAddArg(cmd, "-w");
}
switch (def->clock.offset) {
case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:

View File

@ -0,0 +1,10 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-w \
-u \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci,hd:/tmp/freebsd.img \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve

View File

@ -0,0 +1,3 @@
/usr/sbin/bhyveload \
-m 214 \
-d /tmp/freebsd.img bhyve

View File

@ -0,0 +1,26 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<features>
<msrs unknown='ignore'/>
</features>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -211,6 +211,7 @@ mymain(void)
DO_TEST("cputopology");
DO_TEST_FAILURE("cputopology-nvcpu-mismatch");
DO_TEST("commandline");
DO_TEST("msrs");
/* Address allocation tests */
DO_TEST("addr-single-sata-disk");

View File

@ -0,0 +1,36 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<msrs unknown='ignore'/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -111,6 +111,7 @@ mymain(void)
DO_TEST_DIFFERENT("vnc-vgaconf-io");
DO_TEST_DIFFERENT("vnc-autoport");
DO_TEST_DIFFERENT("commandline");
DO_TEST_DIFFERENT("msrs");
/* Address allocation tests */
DO_TEST_DIFFERENT("addr-single-sata-disk");