mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: only check for PIIX3-specific device addrs on pc-* machinetypes
The implicit IDE, USB, and video controllers provided by the PIIX3 chipset in the pc-* machinetypes are not present on other machinetypes, so we shouldn't be doing the special checking for them. This patch places those validation checks into a separate function that is only called for machine types that have a PIIX3 chip (which happens to be the i440fx-based pc-* machine types). One qemuxml2argv test data file had to be changed - the pseries-usb-multi test had included a piix3-usb-uhci device, which was being placed at a specific address, and also had slot 2 auto reserved for a video device, but the pseries virtual machine doesn't actually have a PIIX3 chip, so even if there was a piix3-usb-uhci driver for it, the device wouldn't need to reside at slot 1 function 2. I just changed the .argv file to have the generic slot info for the two devices that results when the special PIIX3 code isn't executed.
This commit is contained in:
parent
23cc535220
commit
fcbfd58429
@ -1952,46 +1952,15 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
|||||||
(ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2 || \
|
(ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2 || \
|
||||||
(ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3))
|
(ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3))
|
||||||
|
|
||||||
/*
|
|
||||||
* This assigns static PCI slots to all configured devices.
|
static int
|
||||||
* The ordering here is chosen to match the ordering used
|
qemuValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
||||||
* with old QEMU < 0.12, so that if a user updates a QEMU
|
virQEMUCapsPtr qemuCaps,
|
||||||
* host from old QEMU to QEMU >= 0.12, their guests should
|
qemuDomainPCIAddressSetPtr addrs)
|
||||||
* get PCI addresses in the same order as before.
|
|
||||||
*
|
|
||||||
* NB, if they previously hotplugged devices then all bets
|
|
||||||
* are off. Hotplug for old QEMU was unfixably broken wrt
|
|
||||||
* to stable PCI addressing.
|
|
||||||
*
|
|
||||||
* Order is:
|
|
||||||
*
|
|
||||||
* - Host bridge (slot 0)
|
|
||||||
* - PIIX3 ISA bridge, IDE controller, something else unknown, USB controller (slot 1)
|
|
||||||
* - Video (slot 2)
|
|
||||||
*
|
|
||||||
* Incrementally assign slots from 3 onwards:
|
|
||||||
*
|
|
||||||
* - Net
|
|
||||||
* - Sound
|
|
||||||
* - SCSI controllers
|
|
||||||
* - VirtIO block
|
|
||||||
* - VirtIO balloon
|
|
||||||
* - Host device passthrough
|
|
||||||
* - Watchdog (not IB700)
|
|
||||||
*
|
|
||||||
* Prior to this function being invoked, qemuCollectPCIAddress() will have
|
|
||||||
* added all existing PCI addresses from the 'def' to 'addrs'. Thus this
|
|
||||||
* function must only try to reserve addresses if info.type == NONE and
|
|
||||||
* skip over info.type == PCI
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
qemuAssignDevicePCISlots(virDomainDefPtr def,
|
|
||||||
virQEMUCapsPtr qemuCaps,
|
|
||||||
qemuDomainPCIAddressSetPtr addrs)
|
|
||||||
{
|
{
|
||||||
size_t i, j;
|
size_t i;
|
||||||
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
|
||||||
virDevicePCIAddress tmp_addr;
|
virDevicePCIAddress tmp_addr;
|
||||||
|
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||||
virDevicePCIAddressPtr addrptr;
|
virDevicePCIAddressPtr addrptr;
|
||||||
|
|
||||||
/* 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 */
|
||||||
@ -2100,6 +2069,61 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This assigns static PCI slots to all configured devices.
|
||||||
|
* The ordering here is chosen to match the ordering used
|
||||||
|
* with old QEMU < 0.12, so that if a user updates a QEMU
|
||||||
|
* host from old QEMU to QEMU >= 0.12, their guests should
|
||||||
|
* get PCI addresses in the same order as before.
|
||||||
|
*
|
||||||
|
* NB, if they previously hotplugged devices then all bets
|
||||||
|
* are off. Hotplug for old QEMU was unfixably broken wrt
|
||||||
|
* to stable PCI addressing.
|
||||||
|
*
|
||||||
|
* Order is:
|
||||||
|
*
|
||||||
|
* - Host bridge (slot 0)
|
||||||
|
* - PIIX3 ISA bridge, IDE controller, something else unknown, USB controller (slot 1)
|
||||||
|
* - Video (slot 2)
|
||||||
|
*
|
||||||
|
* Incrementally assign slots from 3 onwards:
|
||||||
|
*
|
||||||
|
* - Net
|
||||||
|
* - Sound
|
||||||
|
* - SCSI controllers
|
||||||
|
* - VirtIO block
|
||||||
|
* - VirtIO balloon
|
||||||
|
* - Host device passthrough
|
||||||
|
* - Watchdog (not IB700)
|
||||||
|
*
|
||||||
|
* Prior to this function being invoked, qemuCollectPCIAddress() will have
|
||||||
|
* added all existing PCI addresses from the 'def' to 'addrs'. Thus this
|
||||||
|
* function must only try to reserve addresses if info.type == NONE and
|
||||||
|
* skip over info.type == PCI
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||||
|
virQEMUCapsPtr qemuCaps,
|
||||||
|
qemuDomainPCIAddressSetPtr addrs)
|
||||||
|
{
|
||||||
|
size_t i, j;
|
||||||
|
virDevicePCIAddress tmp_addr;
|
||||||
|
|
||||||
|
if ((STRPREFIX(def->os.machine, "pc-0.") ||
|
||||||
|
STRPREFIX(def->os.machine, "pc-1.") ||
|
||||||
|
STRPREFIX(def->os.machine, "pc-i440") ||
|
||||||
|
STREQ(def->os.machine, "pc") ||
|
||||||
|
STRPREFIX(def->os.machine, "rhel")) &&
|
||||||
|
qemuValidateDevicePCISlotsPIIX3(def, qemuCaps, addrs) < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* PCI controllers */
|
/* PCI controllers */
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
|
@ -3,6 +3,6 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
|||||||
-nographic -nodefconfig -nodefaults -chardev \
|
-nographic -nodefconfig -nodefaults -chardev \
|
||||||
socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
|
socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
|
||||||
-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi \
|
-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi \
|
||||||
-boot c -device piix3-usb-uhci,id=usb,bus=pci,addr=0x1.0x2 \
|
-boot c -device piix3-usb-uhci,id=usb,bus=pci,addr=0x1 \
|
||||||
-device pci-ohci,id=usb1,bus=pci,addr=0x3 -chardev \
|
-device pci-ohci,id=usb1,bus=pci,addr=0x2 -chardev \
|
||||||
pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000
|
pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000
|
||||||
|
Loading…
Reference in New Issue
Block a user