use new pcie port hardware

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>
This commit is contained in:
Dominik Csapak 2019-07-08 11:25:10 +02:00 committed by Thomas Lamprecht
parent 85f0511db3
commit 7583d156fd
4 changed files with 172 additions and 5 deletions

View File

@ -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

View 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);

View 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";

161
pve-q35-4.0.cfg Normal file
View File

@ -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"