Assign spapr-vio bus address to ibmvscsi controller

For pseries guest, the default controller model is
ibmvscsi controller, this controller only can work
on spapr-vio address.

This patch is to assign spapr-vio address type to
ibmvscsi controller and correct vscsi test case.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
(cherry picked from commit bb725ac1fa)
This commit is contained in:
Li Zhang 2012-05-14 14:16:37 +08:00 committed by Cole Robinson
parent 856a23c2bc
commit d8a1c6b70c
2 changed files with 15 additions and 6 deletions

View File

@ -779,6 +779,7 @@ qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info,
int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
{ {
int i, rc; int i, rc;
int model;
/* Default values match QEMU. See spapr_(llan|vscsi|vty).c */ /* Default values match QEMU. See spapr_(llan|vscsi|vty).c */
@ -790,10 +791,18 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
} }
for (i = 0 ; i < def->ncontrollers; i++) { for (i = 0 ; i < def->ncontrollers; i++) {
rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info, model = def->controllers[i]->model;
0x2000ul); if (model == -1 &&
if (rc) def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
return rc; model = qemuDefaultScsiControllerModel(def);
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI &&
def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info,
0x2000ul);
if (rc)
return rc;
}
} }
for (i = 0 ; i < def->nserials; i++) { for (i = 0 ; i < def->nserials; i++) {

View File

@ -1,8 +1,8 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \ pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device spapr-vscsi,id=scsi0,\ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device spapr-vscsi,id=scsi0,\
bus=pci.0,addr=0x3 -drive file=/dev/HostVG/QEMUGuest1,if=none,\ reg=0x2000 -drive file=/dev/HostVG/QEMUGuest1,if=none,\
id=drive-ide0-0-0 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ id=drive-ide0-0-0 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-drive file=/tmp/scsidisk.img,if=none,id=drive-scsi0-0-3-0 \ -drive file=/tmp/scsidisk.img,if=none,id=drive-scsi0-0-3-0 \
-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 \ -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 \
-usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3