X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FQemuServer.pm;h=72641162f694526999a5eaed3e4e2f4d7b27c0d1;hb=2e7b59252cca96e2400513d833354e9ef362a622;hp=b4b15801dc51ba30d6201c0f1d8ec1dcb4e2914d;hpb=32075a2cb828ef3d728875f65a061687e013e213;p=qemu-server.git diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index b4b15801..72641162 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -637,7 +637,13 @@ EODESCR format => $ivshmem_fmt, description => "Inter-VM shared memory. Useful for direct communication between VMs, or to the host.", optional => 1, - } + }, + audio0 => { + type => 'string', + enum => [qw(ich9-intel-hda intel-hda AC97)], + description => "Configure a audio device.", + optional => 1 + }, }; my $cicustom_fmt = { @@ -3628,6 +3634,15 @@ sub config_to_command { push @$cmd, '-drive', "if=pflash,unit=1,format=$format,id=drive-efidisk0,file=$path"; } + # load q35 config + if ($q35) { + # we use different pcie-port hardware for qemu >= 4.0 for passthrough + if (qemu_machine_feature_enabled($machine_type, $kvmver, 4, 0)) { + push @$devices, '-readconfig', '/usr/share/qemu-server/pve-q35-4.0.cfg'; + } else { + push @$devices, '-readconfig', '/usr/share/qemu-server/pve-q35.cfg'; + } + } # add usb controllers my @usbcontrollers = PVE::QemuServer::USB::get_usb_controllers($conf, $bridges, $arch, $machine_type, $usbdesc->{format}, $MAX_USB_DEVICES); @@ -3771,6 +3786,18 @@ sub config_to_command { } } + if ($conf->{"audio0"}) { + my $audiodevice = $conf->{audio0}; + my $audiopciaddr = print_pci_addr("audio0", $bridges, $arch, $machine_type); + + if ($audiodevice eq 'AC97') { + push @$devices, '-device', "AC97,id=sound0${audiopciaddr}"; + } else { + push @$devices, '-device', "${audiodevice},id=sound5${audiopciaddr}"; + 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"; + } + } my $sockets = 1; $sockets = $conf->{smp} if $conf->{smp}; # old style - no longer iused @@ -3854,7 +3881,7 @@ sub config_to_command { push @$machineFlags, "type=${machine_type}"; } - if ($conf->{startdate}) { + if (($conf->{startdate}) && ($conf->{startdate} ne 'now')) { push @$rtcFlags, "base=$conf->{startdate}"; } elsif ($useLocaltime) { push @$rtcFlags, 'base=localtime'; @@ -3868,11 +3895,6 @@ sub config_to_command { push @$cmd, '-k', $conf->{keyboard} if defined($conf->{keyboard}); - # enable sound - #my $soundhw = $conf->{soundhw} || $defaults->{soundhw}; - #push @$cmd, '-soundhw', 'es1370'; - #push @$cmd, '-soundhw', $soundhw if $soundhw; - if (parse_guest_agent($conf)->{enabled}) { my $qgasocket = qmp_socket($vmid, 1); my $pciaddr = print_pci_addr("qga0", $bridges, $arch, $machine_type);