]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: support firmware ISA debug console
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Jan 2022 13:10:16 +0000 (08:10 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 3 Feb 2022 10:59:03 +0000 (10:59 +0000)
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>
docs/formatdomain.rst
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_domain_address.c
src/qemu/qemu_validate.c

index e2f99c60a6d81ac760c5febf75693530a8db8795..8fa5940469dcc230232fb4498cc5b98b294b295b 100644 (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.
index 64a797de46ecafb21f936b05b7ac39e56741047a..964b0c9e2fcef16cf70cebd1f382e8046b09b744 100644 (file)
         <value>spapr-vio-serial</value>
         <value>system-serial</value>
         <value>sclp-serial</value>
+        <value>isa-debug</value>
       </choice>
     </attribute>
   </define>
           <value>16550a</value>
           <value>sclpconsole</value>
           <value>sclplmconsole</value>
+          <value>isa-debugcon</value>
         </choice>
       </attribute>
     </element>
index c8df6dcd4d3afb58463882da0e5ab96183edb971..467f708350e7b05195964bd0e98d48f4d74923b3 100644 (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:
index 0731007355d5f47ab8501872ceca7ba405d2b49a..b2922e8cff2b34d2382db7100297787c26e9ecee 100644 (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;
index bbdaf7391db4c7477b228e84a31318a6b402debd..9713467aa8f47949232e54dd609a661663e02c6b 100644 (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);
 
index 5537bce122a45b97f49fd4cef08fc8ce60e4e3c7..14b585c6e9ce306de8154ce7e8b7faf28417f042 100644 (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 */
index 3e6eed6ec95b6ad9ef3d3723cab1eaacee0dbeea..13aad4fc4d1e0763f39f21a4f8ae71af7e82c690 100644 (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;
index 3bf39f8d93206977e235354be11457b34758bf96..f27e480696faddbc07a4cf88c0e8b9f6977452c1 100644 (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);