this breaks live migration of vms with q35 (without passthrough)....

we should be able to add those rootports on demand (if a 'hostpciX' exists, for X >= 4) via qemu commandline

i do not really want to extend the default setup to include that many root ports (should do no harm really, but is unncecessary)

also i would prefer to avoid another versioned config file for this

we can add a sub (like usb controllers) 'get_pcie_root_ports' which
returns the necessary devices for the commandline

this way we can add them without breaking live migration and
can add additional ports more easily in the future
(also i would for now set it to something like 16; should be enough for some time)

On 9/2/19 12:50 PM, Aaron Lauterer wrote:
Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com>
---
  PVE/QemuServer.pm     |  2 +-
  PVE/QemuServer/PCI.pm | 18 +++++++++++++
  pve-q35-4.0.cfg       | 60 +++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6e3b19e..451fcda 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -769,7 +769,7 @@ my $MAX_SATA_DISKS = 6;
  my $MAX_USB_DEVICES = 5;
  my $MAX_NETS = 32;
  my $MAX_UNUSED_DISKS = 256;
-my $MAX_HOSTPCI_DEVICES = 4;
+my $MAX_HOSTPCI_DEVICES = 10;
  my $MAX_SERIAL_PORTS = 4;
  my $MAX_PARALLEL_PORTS = 3;
  my $MAX_NUMA = 8;
diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index 9c72f3a..abfa462 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -80,6 +80,12 @@ my $devices = {
      'virtio15' => { bus => 2, addr => 10 },
      'ivshmem' => { bus => 2, addr => 11 },
      'audio0' => { bus => 2, addr => 12 },
+    hostpci4 => { bus => 2, addr => 13 },
+    hostpci5 => { bus => 2, addr => 14 },
+    hostpci6 => { bus => 2, addr => 15 },
+    hostpci7 => { bus => 2, addr => 16 },
+    hostpci8 => { bus => 2, addr => 17 },
+    hostpci9 => { bus => 2, addr => 18 },
      'virtioscsi0' => { bus => 3, addr => 1 },
      'virtioscsi1' => { bus => 3, addr => 2 },
      'virtioscsi2' => { bus => 3, addr => 3 },
@@ -147,12 +153,24 @@ sub print_pcie_addr {
        hostpci1 => { bus => "ich9-pcie-port-2", addr => 0 },
        hostpci2 => { bus => "ich9-pcie-port-3", addr => 0 },
        hostpci3 => { bus => "ich9-pcie-port-4", addr => 0 },
+       hostpci4 => { bus => "ich9-pcie-port-5", addr => 0 },
+       hostpci5 => { bus => "ich9-pcie-port-6", addr => 0 },
+       hostpci6 => { bus => "ich9-pcie-port-7", addr => 0 },
+       hostpci7 => { bus => "ich9-pcie-port-8", addr => 0 },
+       hostpci8 => { bus => "ich9-pcie-port-9", addr => 0 },
+       hostpci9 => { bus => "ich9-pcie-port-10", addr => 0 },
        # win7 is picky about pcie assignments
        hostpci0bus0 => { bus => "pcie.0", addr => 16 },
        hostpci1bus0 => { bus => "pcie.0", addr => 17 },
        hostpci2bus0 => { bus => "pcie.0", addr => 18 },
        hostpci3bus0 => { bus => "pcie.0", addr => 19 },
        ivshmem => { bus => 'pcie.0', addr => 20 },
+       hostpci4bus0 => { bus => "pcie.0", addr => 21 },
+       hostpci5bus0 => { bus => "pcie.0", addr => 22 },
+       hostpci6bus0 => { bus => "pcie.0", addr => 23 },
+       hostpci7bus0 => { bus => "pcie.0", addr => 24 },
+       hostpci8bus0 => { bus => "pcie.0", addr => 25 },
+       hostpci9bus0 => { bus => "pcie.0", addr => 26 },
      };
if (defined($devices->{$id}->{bus}) && defined($devices->{$id}->{addr})) {
diff --git a/pve-q35-4.0.cfg b/pve-q35-4.0.cfg
index c931417..307fd10 100644
--- a/pve-q35-4.0.cfg
+++ b/pve-q35-4.0.cfg
@@ -107,6 +107,66 @@
    port = "4"
    chassis = "4"
+[device "ich9-pcie-port-5"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.4"
+  port = "5"
+  chassis = "5"
+
+[device "ich9-pcie-port-6"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.5"
+  port = "6"
+  chassis = "6"
+
+[device "ich9-pcie-port-7"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.6"
+  port = "7"
+  chassis = "7"
+
+[device "ich9-pcie-port-8"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1c.7"
+  port = "8"
+  chassis = "8"
+
+[device "ich9-pcie-port-9"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1d.4"
+  port = "9"
+  chassis = "9"
+
+[device "ich9-pcie-port-10"]
+  driver = "pcie-root-port"
+  x-speed = "16"
+  x-width = "32"
+  multifunction = "on"
+  bus = "pcie.0"
+  addr = "1d.5"
+  port = "10"
+  chassis = "10"
+
  ##
  # Example PCIe switch with two downstream ports
  #





_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to