mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
S390: Enable SCLP Console in QEMU driver
This is the QEMU backend code for the SCLP console support. It includes SCLP capability detection, QEMU command line generation and a test case. Signed-off-by: J.B. Joret <jb@linux.vnet.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
parent
d760255d01
commit
db2b6861dc
@ -199,6 +199,8 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
|
|||||||
"cirrus-vga",
|
"cirrus-vga",
|
||||||
"vmware-svga",
|
"vmware-svga",
|
||||||
"device-video-primary",
|
"device-video-primary",
|
||||||
|
"s390-sclp",
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
struct _qemuCaps {
|
struct _qemuCaps {
|
||||||
@ -1331,6 +1333,7 @@ struct qemuCapsStringFlags qemuCapsObjectTypes[] = {
|
|||||||
{ "usb-hub", QEMU_CAPS_USB_HUB },
|
{ "usb-hub", QEMU_CAPS_USB_HUB },
|
||||||
{ "ich9-ahci", QEMU_CAPS_ICH9_AHCI },
|
{ "ich9-ahci", QEMU_CAPS_ICH9_AHCI },
|
||||||
{ "virtio-blk-s390", QEMU_CAPS_VIRTIO_S390 },
|
{ "virtio-blk-s390", QEMU_CAPS_VIRTIO_S390 },
|
||||||
|
{ "sclpconsole", QEMU_CAPS_SCLP_S390 },
|
||||||
{ "lsi53c895a", QEMU_CAPS_SCSI_LSI },
|
{ "lsi53c895a", QEMU_CAPS_SCSI_LSI },
|
||||||
{ "virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI_PCI },
|
{ "virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI_PCI },
|
||||||
{ "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC },
|
{ "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC },
|
||||||
|
@ -162,6 +162,7 @@ enum qemuCapsFlags {
|
|||||||
QEMU_CAPS_DEVICE_VMWARE_SVGA = 122, /* -device vmware-svga */
|
QEMU_CAPS_DEVICE_VMWARE_SVGA = 122, /* -device vmware-svga */
|
||||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY = 123, /* safe to use -device XXX
|
QEMU_CAPS_DEVICE_VIDEO_PRIMARY = 123, /* safe to use -device XXX
|
||||||
for primary video device */
|
for primary video device */
|
||||||
|
QEMU_CAPS_SCLP_S390 = 124, /* -device sclp* */
|
||||||
|
|
||||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||||
};
|
};
|
||||||
|
@ -4132,6 +4132,38 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
qemuBuildSclpDevStr(virDomainChrDefPtr dev)
|
||||||
|
{
|
||||||
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE) {
|
||||||
|
switch (dev->targetType) {
|
||||||
|
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP:
|
||||||
|
virBufferAddLit(&buf, "sclpconsole");
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM:
|
||||||
|
virBufferAddLit(&buf, "sclplmconsole");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Cannot use slcp with devices other than console"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
|
||||||
|
dev->info.alias, dev->info.alias);
|
||||||
|
if (virBufferError(&buf)) {
|
||||||
|
virReportOOMError();
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
|
error:
|
||||||
|
virBufferFreeAndReset(&buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def)
|
static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
@ -6383,6 +6415,34 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
char *devstr;
|
char *devstr;
|
||||||
|
|
||||||
switch (console->targetType) {
|
switch (console->targetType) {
|
||||||
|
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP:
|
||||||
|
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM:
|
||||||
|
if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("sclp console requires QEMU to support -device"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (!qemuCapsGet(caps, QEMU_CAPS_SCLP_S390)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("sclp console requires QEMU to support s390-sclp"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
virCommandAddArg(cmd, "-chardev");
|
||||||
|
if (!(devstr = qemuBuildChrChardevStr(&console->source,
|
||||||
|
console->info.alias,
|
||||||
|
caps)))
|
||||||
|
goto error;
|
||||||
|
virCommandAddArg(cmd, devstr);
|
||||||
|
VIR_FREE(devstr);
|
||||||
|
|
||||||
|
virCommandAddArg(cmd, "-device");
|
||||||
|
if (!(devstr = qemuBuildSclpDevStr(console)))
|
||||||
|
goto error;
|
||||||
|
virCommandAddArg(cmd, devstr);
|
||||||
|
VIR_FREE(devstr);
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
|
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
|
||||||
if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
8
tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args
Normal file
8
tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||||
|
s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \
|
||||||
|
socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \
|
||||||
|
chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
|
||||||
|
-usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 -device \
|
||||||
|
virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||||
|
-chardev pty,id=charconsole0 \
|
||||||
|
-device sclpconsole,chardev=charconsole0,id=console0
|
24
tests/qemuxml2argvdata/qemuxml2argv-console-sclp.xml
Normal file
24
tests/qemuxml2argvdata/qemuxml2argv-console-sclp.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest1</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory>219100</memory>
|
||||||
|
<currentMemory>219100</currentMemory>
|
||||||
|
<os>
|
||||||
|
<type arch='s390x' machine='s390-virtio'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu</emulator>
|
||||||
|
<disk type='block' device='disk'>
|
||||||
|
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||||
|
<target dev='hda' bus='virtio'/>
|
||||||
|
</disk>
|
||||||
|
<console type='pty'>
|
||||||
|
<target type='sclp'/>
|
||||||
|
</console>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -680,6 +680,9 @@ mymain(void)
|
|||||||
DO_TEST("console-virtio-s390",
|
DO_TEST("console-virtio-s390",
|
||||||
QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
|
QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
|
||||||
QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_S390);
|
QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_S390);
|
||||||
|
DO_TEST("console-sclp",
|
||||||
|
QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
|
||||||
|
QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_SCLP_S390);
|
||||||
DO_TEST("channel-spicevmc",
|
DO_TEST("channel-spicevmc",
|
||||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
||||||
QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
|
QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
|
||||||
|
Loading…
Reference in New Issue
Block a user