[pve-devel] [PATCH qemu-server v2 2/3] fix #413: add SPICE audio device

Andreas Steinel A.Steinel at gmail.com
Tue Jan 8 23:58:00 CET 2019


If you enable SPICE, the audio device will be automatically added. Intel
HD for newer Windows and AC97 otherwise.
---
 PVE/QemuServer.pm     | 9 +++++++++
 PVE/QemuServer/PCI.pm | 1 +
 2 files changed, 10 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 225f0c0..173ae82 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3772,6 +3772,15 @@ sub config_to_command {
 	push @$devices, '-device', "virtio-serial,id=webdav$pciaddr";
 	push @$devices, '-chardev', "spiceport,id=webdav,name=org.spice-space.webdav.0";
 	push @$devices, '-device', "virtserialport,chardev=webdav,name=org.spice-space.webdav.0";
+
+	$pciaddr = print_pci_addr("audio", $bridges, $arch, $machine_type);
+	if ($winversion >= 6) {
+		push @$devices, '-device', "intel-hda,id=sound5$pciaddr";
+		push @$devices, '-device', "hda-micro,id=sound5-codec0,bus=sound5.0,cad=0";
+		push @$devices, '-device', "hda-duplex,id=sound5-codec1,bus=sound5.0,cad=1";
+	} else {
+		push @$devices, '-device', "AC97$pciaddr";
+	}
     }
 
     # enable balloon by default, unless explicitly disabled
diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index 45c1c90..c0ee435 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -69,6 +69,7 @@ my $devices = {
     'net31' => { bus => 1, addr => 26 },
     'xhci' => { bus => 1, addr => 27 },
     'spicewebdav' => { bus => 1, addr => 28 },
+    'audio' => { bus => 1, addr => 29 },
     'virtio6' => { bus => 2, addr => 1 },
     'virtio7' => { bus => 2, addr => 2 },
     'virtio8' => { bus => 2, addr => 3 },
-- 
2.11.0




More information about the pve-devel mailing list