conf: support firmware ISA debug console

Introduce support for

  <serial type='pty'>
    <target type='isa-debug'>
      <model type='isa-debugcon'/>
    </target>
    <address type='isa' iobase='0x402'/>
  </console>

which is used as a way to receive debug messages from the
firmware on x86 platforms.

Note that the default port is hypervisor specific, with QEMU
currently using 0xe9 since that's the original Bochs debug port.
For use with SeaBIOS/OVMF, the iobase port needs to be explicitly
set to 0x402.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2022-01-20 08:10:16 -05:00
parent 82be0ffe63
commit aab943a632
8 changed files with 40 additions and 8 deletions

View File

@ -6418,8 +6418,9 @@ values are, :since:`since 1.0.2` , ``isa-serial`` (usable with x86 guests),
``usb-serial`` (usable whenever USB support is available) and ``pci-serial``
(usable whenever PCI support is available); :since:`since 3.10.0` ,
``spapr-vio-serial`` (usable with ppc64/pseries guests), ``system-serial``
(usable with aarch64/virt and, :since:`since 4.7.0` , riscv/virt guests) and
``sclp-serial`` (usable with s390 and s390x guests) are available as well.
(usable with aarch64/virt and, :since:`since 4.7.0` , riscv/virt guests),
``sclp-serial`` (usable with s390 and s390x guests) are available as well
and :since:`since 8.1.0` ``isa-debug`` (usable with x86 guests).
:since:`Since 3.10.0` , the ``target`` element can have an optional ``model``
subelement; valid values for its ``name`` attribute are: ``isa-serial`` (usable
@ -6428,9 +6429,12 @@ with the ``isa-serial`` target type); ``usb-serial`` (usable with the
target type); ``spapr-vty`` (usable with the ``spapr-vio-serial`` target type);
``pl011`` and, :since:`since 4.7.0` , ``16550a`` (usable with the
``system-serial`` target type); ``sclpconsole`` and ``sclplmconsole`` (usable
with the ``sclp-serial`` target type). Providing a target model is usually
unnecessary: libvirt will automatically pick one that's suitable for the chosen
target type, and overriding that value is generally not recommended.
with the ``sclp-serial`` target type). ``isa-debugcon`` (usable with the
``isa-debug`` target type); provides a virtual console for receiving debug
messages from the firmware on x86 platforms. :since:`Since: 8.1.0`.
Providing a target model is usually unnecessary: libvirt will automatically
pick one that's suitable for the chosen target type, and overriding that
value is generally not recommended.
If any of the attributes is not specified by the user, libvirt will choose a
value suitable for most users.

View File

@ -4401,6 +4401,7 @@
<value>spapr-vio-serial</value>
<value>system-serial</value>
<value>sclp-serial</value>
<value>isa-debug</value>
</choice>
</attribute>
</define>
@ -4417,6 +4418,7 @@
<value>16550a</value>
<value>sclpconsole</value>
<value>sclplmconsole</value>
<value>isa-debugcon</value>
</choice>
</attribute>
</element>

View File

@ -652,6 +652,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget,
"spapr-vio-serial",
"system-serial",
"sclp-serial",
"isa-debug",
);
VIR_ENUM_IMPL(virDomainChrChannelTarget,
@ -686,6 +687,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel,
"sclpconsole",
"sclplmconsole",
"16550a",
"isa-debugcon",
);
VIR_ENUM_IMPL(virDomainChrDevice,
@ -4953,6 +4955,7 @@ virDomainDefAddConsoleCompat(virDomainDef *def)
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
/* Nothing to do */
break;
@ -5397,7 +5400,7 @@ virDomainChrIsaSerialDefPostParse(virDomainDef *def)
}
static void
static int
virDomainChrDefPostParse(virDomainChrDef *chr,
const virDomainDef *def)
{
@ -5411,6 +5414,14 @@ virDomainChrDefPostParse(virDomainChrDef *chr,
chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG &&
!ARCH_IS_X86(def->os.arch)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("isa-debug serial type only valid on x86 architecture"));
return -1;
}
if (chr->target.port == -1 &&
(chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL ||
chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL ||
@ -5424,6 +5435,8 @@ virDomainChrDefPostParse(virDomainChrDef *chr,
chr->target.port = maxport + 1;
}
return 0;
}
@ -5635,8 +5648,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDef *dev,
switch ((virDomainDeviceType)dev->type) {
case VIR_DOMAIN_DEVICE_CHR:
virDomainChrDefPostParse(dev->data.chr, def);
ret = 0;
ret = virDomainChrDefPostParse(dev->data.chr, def);
break;
case VIR_DOMAIN_DEVICE_RNG:

View File

@ -1161,6 +1161,7 @@ typedef enum {
VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO,
VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM,
VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP,
VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG,
VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
} virDomainChrSerialTargetType;
@ -1204,6 +1205,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;

View File

@ -9371,6 +9371,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;
@ -10782,6 +10783,7 @@ qemuBuildSerialChrDeviceProps(const virDomainDef *def,
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);

View File

@ -5192,6 +5192,9 @@ qemuDomainChrDefPostParse(virDomainChrDef *chr,
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE;
break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON;
break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
/* Nothing to do */
@ -6199,6 +6202,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriver *driver,
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
/* Nothing to do */

View File

@ -995,6 +995,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
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:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
return 0;

View File

@ -1817,6 +1817,7 @@ qemuValidateChrSerialTargetTypeToAddressType(int targetType)
{
switch ((virDomainChrSerialTargetType)targetType) {
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB;
@ -1853,6 +1854,8 @@ qemuValidateChrSerialTargetModelToTargetType(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_DEBUG;
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
break;
@ -1876,6 +1879,7 @@ qemuValidateDomainChrTargetDef(const virDomainChrDef *chr)
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO:
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
expected = qemuValidateChrSerialTargetTypeToAddressType(chr->targetType);
@ -1915,6 +1919,7 @@ qemuValidateDomainChrTargetDef(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 = qemuValidateChrSerialTargetModelToTargetType(chr->targetModel);