}
+static int
+bhyveProbeCapsSoundHda(unsigned int *caps, char *binary)
+{
+ return bhyveProbeCapsDeviceHelper(caps, binary,
+ "-s",
+ "0,hda",
+ "pci slot 0:0: unknown device \"hda\"",
+ BHYVE_CAP_SOUND_HDA);
+}
+
+
int
virBhyveProbeCaps(unsigned int *caps)
{
if ((ret = bhyveProbeCapsXHCIController(caps, binary)))
goto out;
+ if ((ret = bhyveProbeCapsSoundHda(caps, binary)))
+ goto out;
+
out:
VIR_FREE(binary);
return ret;
BHYVE_CAP_FBUF = 1 << 4,
BHYVE_CAP_XHCI = 1 << 5,
BHYVE_CAP_CPUTOPOLOGY = 1 << 6,
+ BHYVE_CAP_SOUND_HDA = 1 << 7,
} virBhyveCapsFlags;
int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
}
+static int
+bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UNUSED,
+ virDomainSoundDefPtr sound,
+ bhyveConnPtr driver,
+ virCommandPtr cmd)
+{
+ if (!(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_SOUND_HDA)) {
+ /* Currently, bhyve only supports "hda" sound devices, so
+ if it's not supported, sound devices are not supported at all */
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Sound devices emulation is not supported "
+ "by given bhyve binary"));
+ return -1;
+ }
+
+ if (sound->model != VIR_DOMAIN_SOUND_MODEL_ICH7) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Sound device model is not supported"));
+ return -1;
+ }
+
+ virCommandAddArg(cmd, "-s");
+ virCommandAddArgFormat(cmd, "%d:%d,hda,play=/dev/dsp0",
+ sound->info.addr.pci.slot,
+ sound->info.addr.pci.function);
+ return 0;
+}
+
virCommandPtr
virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
bool dryRun)
}
}
+ for (i = 0; i < def->nsounds; i++) {
+ if (bhyveBuildSoundArgStr(def, def->sounds[i], driver, cmd) < 0)
+ goto error;
+ }
+
if (bhyveDomainDefNeedsISAController(def))
bhyveBuildLPCArgStr(def, cmd);
return -1;
}
+ for (i = 0; i < def->nsounds; i++) {
+ if (!virDeviceInfoPCIAddressIsWanted(&def->sounds[i]->info))
+ continue;
+ if (virDomainPCIAddressReserveNextAddr(addrs,
+ &def->sounds[i]->info,
+ VIR_PCI_CONNECT_TYPE_PCI_DEVICE,
+ -1) < 0)
+ return -1;
+ }
return 0;
}
--- /dev/null
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-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 \
+-s 4:0,hda,play=/dev/dsp0 bhyve
--- /dev/null
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
--- /dev/null
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+ <memory>219136</memory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <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>
+ <sound model='ich7'/>
+ </devices>
+</domain>
driver.bhyvecaps = BHYVE_CAP_RTC_UTC | BHYVE_CAP_AHCI32SLOT | \
BHYVE_CAP_NET_E1000 | BHYVE_CAP_LPC_BOOTROM | \
BHYVE_CAP_FBUF | BHYVE_CAP_XHCI | \
- BHYVE_CAP_CPUTOPOLOGY;
+ BHYVE_CAP_CPUTOPOLOGY | BHYVE_CAP_SOUND_HDA;
DO_TEST("base");
DO_TEST("wired");
DO_TEST_FAILURE("cputopology-nvcpu-mismatch");
DO_TEST("commandline");
DO_TEST("msrs");
+ DO_TEST("sound");
/* Address allocation tests */
DO_TEST("addr-single-sata-disk");
driver.bhyvecaps &= ~BHYVE_CAP_CPUTOPOLOGY;
DO_TEST_FAILURE("cputopology");
+ driver.bhyvecaps &= ~BHYVE_CAP_SOUND_HDA;
+ DO_TEST_FAILURE("sound");
+
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
virPortAllocatorRangeFree(driver.remotePorts);
--- /dev/null
+<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>
+ <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>
+ <sound model='ich7'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </sound>
+ </devices>
+</domain>
DO_TEST_DIFFERENT("vnc-autoport");
DO_TEST_DIFFERENT("commandline");
DO_TEST_DIFFERENT("msrs");
+ DO_TEST_DIFFERENT("sound");
/* Address allocation tests */
DO_TEST_DIFFERENT("addr-single-sata-disk");