]> git.proxmox.com Git - qemu-server.git/commitdiff
use new pcie port hardware
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 8 Jul 2019 09:25:10 +0000 (11:25 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 8 Jul 2019 11:31:55 +0000 (13:31 +0200)
with qemu 4.0 we can make use of the new pcie-root-ports with settings
for the width/speed which can resolve issues with some hardware combinations
when negioating link speed

so we add a new q35 cfg that we include with machine types >= 4.0
to preserve live migration of machines without passthrough but q35

for details about the link speeds see:

pcie: Enhanced link speed and width support
https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg02827.html

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Makefile
PVE/QemuServer.pm
PVE/QemuServer/USB.pm
pve-q35-4.0.cfg [new file with mode: 0644]

index 8274060f18bbf0f43aa21419f173af4285ab358c..6e8fc78ac855e14556d46d62276680091f04111d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,7 @@ install: ${PKGSOURCES}
        install -d ${DESTDIR}/usr/share/${PACKAGE}
        install -m 0644 pve-usb.cfg ${DESTDIR}/usr/share/${PACKAGE}
        install -m 0644 pve-q35.cfg ${DESTDIR}/usr/share/${PACKAGE}
+       install -m 0644 pve-q35-4.0.cfg ${DESTDIR}/usr/share/${PACKAGE}
        install -m 0644 -D qm.bash-completion ${DESTDIR}/${BASHCOMPLDIR}/qm
        install -m 0644 -D qmrestore.bash-completion ${DESTDIR}/${BASHCOMPLDIR}/qmrestore
        install -m 0644 -D qm.zsh-completion ${DESTDIR}/${ZSHCOMPLDIR}/_qm
index 5ef92a3f69613a92c3f483a85b8ebf48e2747bdb..9f29927ffa20d907bf4cdb26a736966019893391 100644 (file)
@@ -3628,6 +3628,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);
index 9eaacccbda1d1608b304a9f443555c0511da2442..a2097b974e4bbb64d4922358a71fc319da005319 100644 (file)
@@ -42,11 +42,7 @@ sub get_usb_controllers {
     if ($arch eq 'aarch64') {
         $pciaddr = print_pci_addr('ehci', $bridges, $arch, $machine);
         push @$devices, '-device', "usb-ehci,id=ehci$pciaddr";
-    } elsif ($machine =~ /q35/) { # FIXME: combine this and machine_type_is_q35
-       # the q35 chipset support native usb2, so we enable usb controller
-       # by default for this machine type
-        push @$devices, '-readconfig', '/usr/share/qemu-server/pve-q35.cfg';
-    } else {
+    } elsif ($machine !~ /q35/) { # FIXME: combine this and machine_type_is_q35
         $pciaddr = print_pci_addr("piix3", $bridges, $arch, $machine);
         push @$devices, '-device', "piix3-usb-uhci,id=uhci$pciaddr.0x2";
 
diff --git a/pve-q35-4.0.cfg b/pve-q35-4.0.cfg
new file mode 100644 (file)
index 0000000..9a294bd
--- /dev/null
@@ -0,0 +1,161 @@
+[device "ehci"]
+  driver = "ich9-usb-ehci1"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1d.7"
+
+[device "uhci-1"]
+  driver = "ich9-usb-uhci1"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1d.0"
+  masterbus = "ehci.0"
+  firstport = "0"
+
+[device "uhci-2"]
+  driver = "ich9-usb-uhci2"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1d.1"
+  masterbus = "ehci.0"
+  firstport = "2"
+
+[device "uhci-3"]
+  driver = "ich9-usb-uhci3"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1d.2"
+  masterbus = "ehci.0"
+  firstport = "4"
+
+[device "ehci-2"]
+  driver = "ich9-usb-ehci2"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1a.7"
+
+[device "uhci-4"]
+  driver = "ich9-usb-uhci4"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1a.0"
+  masterbus = "ehci-2.0"
+  firstport = "0"
+
+[device "uhci-5"]
+  driver = "ich9-usb-uhci5"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1a.1"
+  masterbus = "ehci-2.0"
+  firstport = "2"
+
+[device "uhci-6"]
+  driver = "ich9-usb-uhci6"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1a.2"
+  masterbus = "ehci-2.0"
+  firstport = "4"
+
+
+[device "audio0"]
+  driver = "ich9-intel-hda"
+  bus = "pcie.0"
+  addr = "1b.0"
+
+
+[device "ich9-pcie-port-1"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.0"
+  port = "1"
+  chassis = "1"
+
+[device "ich9-pcie-port-2"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.1"
+  port = "2"
+  chassis = "2"
+
+[device "ich9-pcie-port-3"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.2"
+  port = "3"
+  chassis = "3"
+
+[device "ich9-pcie-port-4"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.3"
+  port = "4"
+  chassis = "4"
+
+##
+# Example PCIe switch with two downstream ports
+#
+#[device "pcie-switch-upstream-port-1"]
+#  driver = "x3130-upstream"
+#  bus = "ich9-pcie-port-4"
+#  addr = "00.0"
+#
+#[device "pcie-switch-downstream-port-1-1"]
+#  driver = "xio3130-downstream"
+#  multifunction = "on"
+#  bus = "pcie-switch-upstream-port-1"
+#  addr = "00.0"
+#  port = "1"
+#  chassis = "5"
+#
+#[device "pcie-switch-downstream-port-1-2"]
+#  driver = "xio3130-downstream"
+#  multifunction = "on"
+#  bus = "pcie-switch-upstream-port-1"
+#  addr = "00.1"
+#  port = "1"
+#  chassis = "6"
+
+
+
+[device "pcidmi"]
+  driver = "i82801b11-bridge"
+  bus = "pcie.0"
+  addr = "1e.0"
+
+[device "pci.0"]
+  driver = "pci-bridge"
+  bus = "pcidmi"
+  addr = "1.0"
+  chassis_nr = "1"
+
+[device "pci.1"]
+  driver = "pci-bridge"
+  bus = "pcidmi"
+  addr = "2.0"
+  chassis_nr = "2"
+
+[device "pci.2"]
+  driver = "pci-bridge"
+  bus = "pcidmi"
+  addr = "3.0"
+  chassis_nr = "3"
+
+[device "pci.3"]
+  driver = "pci-bridge"
+  bus = "pcidmi"
+  addr = "4.0"
+  chassis_nr = "4"