mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-04 10:55:19 +00:00
qemu: replace a lot of "def->controllers[i]" with equivalent "cont"
There's no functional change here. This pointer was just used so many times that the extra long lines became annoying.
This commit is contained in:
parent
7bd8312e7f
commit
9ca53303f8
@ -220,19 +220,23 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
model = def->controllers[i]->model;
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
|
|
||||||
|
model = cont->model;
|
||||||
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
|
||||||
if (qemuDomainSetSCSIControllerModel(def, qemuCaps, &model) < 0)
|
if (qemuDomainSetSCSIControllerModel(def, qemuCaps, &model) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI &&
|
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI &&
|
||||||
def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
|
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
||||||
if (qemuDomainAssignSpaprVIOAddress(def, &def->controllers[i]->info,
|
}
|
||||||
VIO_ADDR_SCSI) < 0)
|
if (qemuDomainAssignSpaprVIOAddress(def, &cont->info,
|
||||||
|
VIO_ADDR_SCSI) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->nserials; i++) {
|
for (i = 0; i < def->nserials; i++) {
|
||||||
if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||||
@ -292,13 +296,13 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
if ((def->controllers[i]->type ==
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL ||
|
|
||||||
def->controllers[i]->type ==
|
if ((cont->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL ||
|
||||||
VIR_DOMAIN_CONTROLLER_TYPE_SCSI) &&
|
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) &&
|
||||||
def->controllers[i]->info.type ==
|
cont->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
cont->info.type = type;
|
||||||
def->controllers[i]->info.type = type;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->memballoon &&
|
if (def->memballoon &&
|
||||||
@ -568,9 +572,10 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
size_t idx = def->controllers[i]->idx;
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
|
size_t idx = cont->idx;
|
||||||
|
|
||||||
if (def->controllers[i]->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI)
|
if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (idx >= addrs->nbuses) {
|
if (idx >= addrs->nbuses) {
|
||||||
@ -580,8 +585,7 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainPCIAddressBusSetModel(&addrs->buses[idx],
|
if (virDomainPCIAddressBusSetModel(&addrs->buses[idx], cont->model) < 0)
|
||||||
def->controllers[i]->model) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,44 +615,46 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
|||||||
|
|
||||||
/* Verify that first IDE and USB controllers (if any) is on the PIIX3, fn 1 */
|
/* Verify that first IDE and USB controllers (if any) is on the PIIX3, fn 1 */
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
|
|
||||||
/* First IDE controller lives on the PIIX3 at slot=1, function=1 */
|
/* First IDE controller lives on the PIIX3 at slot=1, function=1 */
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
||||||
def->controllers[i]->idx == 0) {
|
cont->idx == 0) {
|
||||||
if (virDeviceInfoPCIAddressPresent(&def->controllers[i]->info)) {
|
if (virDeviceInfoPCIAddressPresent(&cont->info)) {
|
||||||
if (def->controllers[i]->info.addr.pci.domain != 0 ||
|
if (cont->info.addr.pci.domain != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.bus != 0 ||
|
cont->info.addr.pci.bus != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.slot != 1 ||
|
cont->info.addr.pci.slot != 1 ||
|
||||||
def->controllers[i]->info.addr.pci.function != 1) {
|
cont->info.addr.pci.function != 1) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Primary IDE controller must have PCI address 0:0:1.1"));
|
_("Primary IDE controller must have PCI address 0:0:1.1"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
def->controllers[i]->info.addr.pci.domain = 0;
|
cont->info.addr.pci.domain = 0;
|
||||||
def->controllers[i]->info.addr.pci.bus = 0;
|
cont->info.addr.pci.bus = 0;
|
||||||
def->controllers[i]->info.addr.pci.slot = 1;
|
cont->info.addr.pci.slot = 1;
|
||||||
def->controllers[i]->info.addr.pci.function = 1;
|
cont->info.addr.pci.function = 1;
|
||||||
}
|
}
|
||||||
} else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
} else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
||||||
def->controllers[i]->idx == 0 &&
|
cont->idx == 0 &&
|
||||||
(def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI ||
|
(cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI ||
|
||||||
def->controllers[i]->model == -1)) {
|
cont->model == -1)) {
|
||||||
if (virDeviceInfoPCIAddressPresent(&def->controllers[i]->info)) {
|
if (virDeviceInfoPCIAddressPresent(&cont->info)) {
|
||||||
if (def->controllers[i]->info.addr.pci.domain != 0 ||
|
if (cont->info.addr.pci.domain != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.bus != 0 ||
|
cont->info.addr.pci.bus != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.slot != 1 ||
|
cont->info.addr.pci.slot != 1 ||
|
||||||
def->controllers[i]->info.addr.pci.function != 2) {
|
cont->info.addr.pci.function != 2) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("PIIX3 USB controller must have PCI address 0:0:1.2"));
|
_("PIIX3 USB controller must have PCI address 0:0:1.2"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
def->controllers[i]->info.addr.pci.domain = 0;
|
cont->info.addr.pci.domain = 0;
|
||||||
def->controllers[i]->info.addr.pci.bus = 0;
|
cont->info.addr.pci.bus = 0;
|
||||||
def->controllers[i]->info.addr.pci.slot = 1;
|
cont->info.addr.pci.slot = 1;
|
||||||
def->controllers[i]->info.addr.pci.function = 2;
|
cont->info.addr.pci.function = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -743,37 +749,37 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
|||||||
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
|
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
switch (def->controllers[i]->type) {
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
|
|
||||||
|
switch (cont->type) {
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
|
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
|
||||||
/* Verify that the first SATA controller is at 00:1F.2 the
|
/* Verify that the first SATA controller is at 00:1F.2 the
|
||||||
* q35 machine type *always* has a SATA controller at this
|
* q35 machine type *always* has a SATA controller at this
|
||||||
* address.
|
* address.
|
||||||
*/
|
*/
|
||||||
if (def->controllers[i]->idx == 0) {
|
if (cont->idx == 0) {
|
||||||
if (virDeviceInfoPCIAddressPresent(&def->controllers[i]->info)) {
|
if (virDeviceInfoPCIAddressPresent(&cont->info)) {
|
||||||
if (def->controllers[i]->info.addr.pci.domain != 0 ||
|
if (cont->info.addr.pci.domain != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.bus != 0 ||
|
cont->info.addr.pci.bus != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.slot != 0x1F ||
|
cont->info.addr.pci.slot != 0x1F ||
|
||||||
def->controllers[i]->info.addr.pci.function != 2) {
|
cont->info.addr.pci.function != 2) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Primary SATA controller must have PCI address 0:0:1f.2"));
|
_("Primary SATA controller must have PCI address 0:0:1f.2"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
def->controllers[i]->info.addr.pci.domain = 0;
|
cont->info.addr.pci.domain = 0;
|
||||||
def->controllers[i]->info.addr.pci.bus = 0;
|
cont->info.addr.pci.bus = 0;
|
||||||
def->controllers[i]->info.addr.pci.slot = 0x1F;
|
cont->info.addr.pci.slot = 0x1F;
|
||||||
def->controllers[i]->info.addr.pci.function = 2;
|
cont->info.addr.pci.function = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
|
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
|
||||||
if ((def->controllers[i]->model
|
if ((cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1) &&
|
||||||
== VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1) &&
|
(cont->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)) {
|
||||||
(def->controllers[i]->info.type
|
|
||||||
== VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)) {
|
|
||||||
/* Try to assign the first found USB2 controller to
|
/* Try to assign the first found USB2 controller to
|
||||||
* 00:1D.0 and 2nd to 00:1A.0 (because that is their
|
* 00:1D.0 and 2nd to 00:1A.0 (because that is their
|
||||||
* standard location on real Q35 hardware) unless they
|
* standard location on real Q35 hardware) unless they
|
||||||
@ -798,21 +804,19 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
|||||||
if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr,
|
if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr,
|
||||||
flags, false, true) < 0)
|
flags, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
def->controllers[i]->info.type
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
= VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
cont->info.addr.pci.domain = 0;
|
||||||
def->controllers[i]->info.addr.pci.domain = 0;
|
cont->info.addr.pci.bus = 0;
|
||||||
def->controllers[i]->info.addr.pci.bus = 0;
|
cont->info.addr.pci.slot = tmp_addr.slot;
|
||||||
def->controllers[i]->info.addr.pci.slot = tmp_addr.slot;
|
cont->info.addr.pci.function = 0;
|
||||||
def->controllers[i]->info.addr.pci.function = 0;
|
cont->info.addr.pci.multi = VIR_TRISTATE_SWITCH_ON;
|
||||||
def->controllers[i]->info.addr.pci.multi
|
|
||||||
= VIR_TRISTATE_SWITCH_ON;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
|
case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
|
||||||
if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE &&
|
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE &&
|
||||||
def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
cont->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||||
/* Try to assign this bridge to 00:1E.0 (because that
|
/* Try to assign this bridge to 00:1E.0 (because that
|
||||||
* is its standard location on real hardware) unless
|
* is its standard location on real hardware) unless
|
||||||
* it's already taken, but don't insist on it.
|
* it's already taken, but don't insist on it.
|
||||||
@ -823,11 +827,11 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
|||||||
if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr,
|
if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr,
|
||||||
flags, true, false) < 0)
|
flags, true, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
def->controllers[i]->info.addr.pci.domain = 0;
|
cont->info.addr.pci.domain = 0;
|
||||||
def->controllers[i]->info.addr.pci.bus = 0;
|
cont->info.addr.pci.bus = 0;
|
||||||
def->controllers[i]->info.addr.pci.slot = 0x1E;
|
cont->info.addr.pci.slot = 0x1E;
|
||||||
def->controllers[i]->info.addr.pci.function = 0;
|
cont->info.addr.pci.function = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1001,12 +1005,14 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
|
|
||||||
/* PCI controllers */
|
/* PCI controllers */
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
virDomainControllerModelPCI model = def->controllers[i]->model;
|
|
||||||
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
|
||||||
|
virDomainControllerModelPCI model = cont->model;
|
||||||
|
|
||||||
if (model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
|
if (model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
|
||||||
model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT ||
|
model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT ||
|
||||||
!virDeviceInfoPCIAddressWanted(&def->controllers[i]->info))
|
!virDeviceInfoPCIAddressWanted(&cont->info))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* convert the type of controller into a "CONNECT_TYPE"
|
/* convert the type of controller into a "CONNECT_TYPE"
|
||||||
@ -1015,11 +1021,11 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
*/
|
*/
|
||||||
flags = virDomainPCIControllerModelToConnectType(model);
|
flags = virDomainPCIControllerModelToConnectType(model);
|
||||||
if (virDomainPCIAddressReserveNextSlot(addrs,
|
if (virDomainPCIAddressReserveNextSlot(addrs,
|
||||||
&def->controllers[i]->info,
|
&cont->info, flags) < 0) {
|
||||||
flags) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* all other devices that plug into a PCI slot are treated as a
|
/* all other devices that plug into a PCI slot are treated as a
|
||||||
* PCI endpoint devices that require a hotplug-capable slot
|
* PCI endpoint devices that require a hotplug-capable slot
|
||||||
@ -1071,38 +1077,40 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
|
|
||||||
/* Device controllers (SCSI, USB, but not IDE, FDC or CCID) */
|
/* Device controllers (SCSI, USB, but not IDE, FDC or CCID) */
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
|
|
||||||
/* PCI controllers have been dealt with earlier */
|
/* PCI controllers have been dealt with earlier */
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI)
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* USB controller model 'none' doesn't need a PCI address */
|
/* USB controller model 'none' doesn't need a PCI address */
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
||||||
def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
|
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* FDC lives behind the ISA bridge; CCID is a usb device */
|
/* FDC lives behind the ISA bridge; CCID is a usb device */
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC ||
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC ||
|
||||||
def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_CCID)
|
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_CCID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* First IDE controller lives on the PIIX3 at slot=1, function=1,
|
/* First IDE controller lives on the PIIX3 at slot=1, function=1,
|
||||||
dealt with earlier on*/
|
dealt with earlier on*/
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
|
||||||
def->controllers[i]->idx == 0)
|
cont->idx == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!virDeviceInfoPCIAddressWanted(&def->controllers[i]->info))
|
if (!virDeviceInfoPCIAddressWanted(&cont->info))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* USB2 needs special handling to put all companions in the same slot */
|
/* USB2 needs special handling to put all companions in the same slot */
|
||||||
if (IS_USB2_CONTROLLER(def->controllers[i])) {
|
if (IS_USB2_CONTROLLER(cont)) {
|
||||||
virPCIDeviceAddress addr = {0};
|
virPCIDeviceAddress addr = {0};
|
||||||
bool foundAddr = false;
|
bool foundAddr = false;
|
||||||
|
|
||||||
memset(&tmp_addr, 0, sizeof(tmp_addr));
|
memset(&tmp_addr, 0, sizeof(tmp_addr));
|
||||||
for (j = 0; j < def->ncontrollers; j++) {
|
for (j = 0; j < def->ncontrollers; j++) {
|
||||||
if (IS_USB2_CONTROLLER(def->controllers[j]) &&
|
if (IS_USB2_CONTROLLER(def->controllers[j]) &&
|
||||||
def->controllers[j]->idx == def->controllers[i]->idx &&
|
def->controllers[j]->idx == cont->idx &&
|
||||||
virDeviceInfoPCIAddressPresent(&def->controllers[j]->info)) {
|
virDeviceInfoPCIAddressPresent(&def->controllers[j]->info)) {
|
||||||
addr = def->controllers[j]->info.addr.pci;
|
addr = def->controllers[j]->info.addr.pci;
|
||||||
foundAddr = true;
|
foundAddr = true;
|
||||||
@ -1110,7 +1118,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (def->controllers[i]->model) {
|
switch (cont->model) {
|
||||||
case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
|
case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
|
||||||
addr.function = 7;
|
addr.function = 7;
|
||||||
addr.multi = VIR_TRISTATE_SWITCH_ABSENT;
|
addr.multi = VIR_TRISTATE_SWITCH_ABSENT;
|
||||||
@ -1147,15 +1155,15 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
false, foundAddr) < 0)
|
false, foundAddr) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
def->controllers[i]->info.addr.pci = addr;
|
cont->info.addr.pci = addr;
|
||||||
} else {
|
} else {
|
||||||
if (virDomainPCIAddressReserveNextSlot(addrs,
|
if (virDomainPCIAddressReserveNextSlot(addrs,
|
||||||
&def->controllers[i]->info,
|
&cont->info, flags) < 0) {
|
||||||
flags) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Disks (VirtIO only for now) */
|
/* Disks (VirtIO only for now) */
|
||||||
for (i = 0; i < def->ndisks; i++) {
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
@ -1400,8 +1408,10 @@ qemuDomainAddressFindNewBusNr(virDomainDefPtr def)
|
|||||||
int lowestBusNr = 256;
|
int lowestBusNr = 256;
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
int thisBusNr = def->controllers[i]->opts.pciopts.busNr;
|
|
||||||
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
|
||||||
|
int thisBusNr = cont->opts.pciopts.busNr;
|
||||||
|
|
||||||
if (thisBusNr >= 0 && thisBusNr < lowestBusNr)
|
if (thisBusNr >= 0 && thisBusNr < lowestBusNr)
|
||||||
lowestBusNr = thisBusNr;
|
lowestBusNr = thisBusNr;
|
||||||
@ -1436,9 +1446,11 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
|||||||
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
|
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
|
||||||
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
if ((int) def->controllers[i]->idx > max_idx)
|
|
||||||
max_idx = def->controllers[i]->idx;
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
|
||||||
|
if ((int) cont->idx > max_idx)
|
||||||
|
max_idx = cont->idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user