This interface can be used for example by firmware to print debug messages. Here is domain xml example: <serial type='pty'> <target type='isa-serial' port='0'> <model name='isa-debugcon'/> </target> <address type='isa' iobase='0x402'/> </serial> Add checks to make sure this new serial type won't be reported as back-compat console. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- docs/formatdomain.html.in | 3 +- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 4 +++ src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 2 ++ src/qemu/qemu_domain.c | 3 ++ tests/qemuxml2argvdata/isa-serial-debugcon.xml | 36 ++++++++++++++++++++ tests/qemuxml2xmloutdata/isa-serial-debugcon.xml | 43 ++++++++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 9 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/isa-serial-debugcon.xml create mode 100644 tests/qemuxml2xmloutdata/isa-serial-debugcon.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7f07bb7..857c2af 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7089,7 +7089,8 @@ qemu-kvm -net nic,model=? /dev/null <span class="since">Since 3.10.0</span>, the <code>target</code> element can have an optional <code>model</code> subelement; valid values for its <code>name</code> attribute are: - <code>isa-serial</code> (usable with the <code>isa-serial</code> target + <code>isa-serial</code> and <span class="since">since 5.1.0</span>, + <code>isa-debugcon</code>(usable with the <code>isa-serial</code> target type); <code>usb-serial</code> (usable with the <code>usb-serial</code> target type); <code>pci-serial</code> (usable with the <code>pci-serial</code> target type); diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ba80440..8fbcae2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3763,6 +3763,7 @@ <value>16550a</value> <value>sclpconsole</value> <value>sclplmconsole</value> + <value>isa-debugcon</value> </choice> </attribute> </element> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1fc4c8a..628f5cc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -516,6 +516,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, "sclpconsole", "sclplmconsole", "16550a", + "isa-debugcon", ); VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, @@ -4392,6 +4393,9 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) switch ((virDomainChrSerialTargetType) def->serials[0]->targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + if (def->serials[0]->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON) + break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2bc3f87..8d066e0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1134,6 +1134,7 @@ typedef enum { VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON, VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST } virDomainChrSerialTargetModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 374836a..aeab619 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9364,6 +9364,7 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: return QEMU_CAPS_DEVICE_PL011; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -10795,6 +10796,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON: caps = qemuChrSerialTargetModelToCaps(serial->targetModel); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b6c1a0e..90bc6de 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4376,6 +4376,8 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: break; @@ -4438,6 +4440,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON: expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel); diff --git a/tests/qemuxml2argvdata/isa-serial-debugcon.xml b/tests/qemuxml2argvdata/isa-serial-debugcon.xml new file mode 100644 index 0000000..1c2e1c3 --- /dev/null +++ b/tests/qemuxml2argvdata/isa-serial-debugcon.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu> + <os> + <type arch='i686' machine='pc'>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-system-i686</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <serial type='pipe'> + <source path='/tmp/debugcon'/> + <target type='isa-serial' port='0'> + <model name='isa-debugcon'/> + </target> + <address type='isa' iobase='0x402'/> + </serial> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml b/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml new file mode 100644 index 0000000..29ead19 --- /dev/null +++ b/tests/qemuxml2xmloutdata/isa-serial-debugcon.xml @@ -0,0 +1,43 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu> + <os> + <type arch='i686' machine='pc'>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-system-i686</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <serial type='pipe'> + <source path='/tmp/debugcon'/> + <target type='isa-serial' port='0'> + <model name='isa-debugcon'/> + </target> + <address type='isa' iobase='0x402'/> + </serial> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 85261cb..768f7f2 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -491,6 +491,8 @@ mymain(void) DO_TEST("pci-rom-disabled-invalid", NONE); DO_TEST("pci-serial-dev-chardev", NONE); + DO_TEST("isa-serial-debugcon", NONE); + DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS); DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS); DO_TEST("luks-disks", NONE); -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list