Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: +16 open pci root ports #984

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1100,48 +1100,55 @@ void writeDevices() {
boolean videoExists = false;
boolean forceRefreshDevices = false;
boolean pciERootExists = false;
int pciEPorts = 0;
int pciEPortsInUse = 0;
int pciEPortsAvailable = 0;
for (VmDevice device : devices) {
if (!device.isPlugged()) {
continue;
}

switch (device.getType()) {
case BALLOON:
pciEPortsInUse++;
balloonExists = true;
if (legacyVirtio) {
device.getSpecParams().put("model", "virtio-transitional");
}
writeBalloon(device);
break;
case SMARTCARD:
pciEPortsInUse++;
writeSmartcard(device);
break;
case WATCHDOG:
pciEPortsInUse++;
writeWatchdog(device);
break;
case MEMORY:
// memory devices are only used for hot-plug
break;
case VIDEO:
pciEPortsInUse++;
videoExists = true;
writeVideo(device);
break;
case CONTROLLER:
switch (device.getDevice()) {
case "usb":
pciEPortsInUse++;
if ("qemu-xhci".equals(device.getSpecParams().get("model"))) {
device.getSpecParams().put("ports", 8);
}
break;
case "virtio-serial":
pciEPortsInUse++;
device.getSpecParams().put("index", 0);
device.getSpecParams().put("ports", 16);
if (legacyVirtio) {
device.getSpecParams().put("model", "virtio-transitional");
}
break;
case "virtio-scsi":
pciEPortsInUse++;
device.setDevice(VdsProperties.Scsi);
device.getSpecParams().put("index", virtioScsiIndex++);
if (legacyVirtio) {
Expand All @@ -1155,7 +1162,7 @@ void writeDevices() {
if ("pcie-root".equals(model)) {
pciERootExists = true;
} else if ("pcie-root-port".equals(model)) {
pciEPorts++;
pciEPortsAvailable++;
}
break;
}
Expand All @@ -1166,9 +1173,11 @@ void writeDevices() {
spiceExists = spiceExists || device.getDevice().equals("spice");
break;
case SOUND:
pciEPortsInUse++;
writeSound(device);
break;
case RNG:
pciEPortsInUse++;
writeRng(device);
break;
case TPM:
Expand Down Expand Up @@ -1197,6 +1206,7 @@ void writeDevices() {
}
break;
case INTERFACE:
pciEPortsInUse++;
interfaceDevices.add(device);
break;
case REDIR:
Expand Down Expand Up @@ -1245,7 +1255,7 @@ void writeDevices() {

if (vm.getClusterArch().getFamily() == ArchitectureType.x86
&& vm.getBiosType().getChipsetType() == ChipsetType.Q35) {
writePciEControllers(pciERootExists, pciEPorts);
writePciEControllers(pciERootExists, pciEPortsInUse, pciEPortsAvailable);
}

updateBootOrder(diskDevices, cdromDevices, interfaceDevices);
Expand Down Expand Up @@ -2117,16 +2127,15 @@ protected static Stream<String> adjustSpiceSecureChannels(String[] spiceSecureCh
.filter(Objects::nonNull);
}

private void writePciEControllers(boolean rootExists, int ports) {
private void writePciEControllers(boolean rootExists, int pciEPortsInUse, int pciEPortsAvailable) {
if (!rootExists) {
writer.writeStartElement("controller");
writer.writeAttributeString("type", "pci");
writer.writeAttributeString("model", "pcie-root");
writer.writeEndElement();
}

int numOfPorts = Config.<Integer> getValue(ConfigValues.NumOfPciExpressPorts);
for (int i = ports; i < numOfPorts; i++) {
int requiredFreePorts = Config.<Integer> getValue(ConfigValues.NumOfPciExpressPorts);
for (int i = pciEPortsAvailable; i < requiredFreePorts + pciEPortsInUse; i++) {
writer.writeStartElement("controller");
writer.writeAttributeString("type", "pci");
writer.writeAttributeString("model", "pcie-root-port");
Expand Down
2 changes: 1 addition & 1 deletion packaging/etc/engine-config/engine-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ HostMonitoringWatchdogIntervalInSeconds.type=Integer
HostMonitoringWatchdogIntervalInSeconds.description="Host monitoring watchdog service interval to check if host monitoring is running."
HostMonitoringWatchdogInactivityThresholdInSeconds.type=Integer
HostMonitoringWatchdogInactivityThresholdInSeconds.description="Warning threshold value of the host monitoring inactivity. Warning will printed in the logs (ie. engine.log) when reached."
NumOfPciExpressPorts.description="Determines the number of PCI Express ports virtual machines are configured with"
NumOfPciExpressPorts.description="Determines the number of free PCI Express ports a virtual machine needs to have when a started."
NumOfPciExpressPorts.type=Integer
# Parallel migrations
ParallelMigrationsSupported.description=Enable parallel migrations support.
Expand Down
Loading