[libvirt PATCH 1/2] conf: support firmware ISA debug console

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce support for

  <console type='pty'>
    <target type='isa-debug'/>
  </console>

which is used as a way to receive debug messages from the
firmware on x86 platforms. The iobase port will default
to 0x402 which is what SeaBIOS/OVMF expect normally.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 docs/formatdomain.rst         |  3 ++-
 docs/schemas/domaincommon.rng |  1 +
 src/conf/domain_conf.c        | 23 +++++++++++++++++------
 src/conf/domain_conf.h        |  1 +
 src/qemu/qemu_command.c       |  1 +
 5 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index acd9020830..9e4e5fd036 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -6483,7 +6483,8 @@ values for the ``type`` attribute are: ``serial`` (described below); ``virtio``
 (usable for s390 and s390x QEMU guests) are supported for compatibility reasons
 but should not be used for new guests: use the ``sclpconsole`` and
 ``sclplmconsole`` target models, respectively, with the ``serial`` element
-instead.
+instead. ``isa-debug`` provides a virtual console for receiving debug
+messages from the firmware on x86 platforms. :since:`Since: 8.1.0`.
 
 Of the target types listed above, ``serial`` is special in that it doesn't
 represents a separate device, but rather the same device as the first ``serial``
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 169b8d8dee..4ff3bcda24 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4387,6 +4387,7 @@
         <value>openvz</value>
         <value>sclp</value>
         <value>sclplm</value>
+        <value>isa-debug</value>
       </choice>
     </attribute>
   </define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 393f9d9478..c73085a513 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -672,6 +672,7 @@ VIR_ENUM_IMPL(virDomainChrConsoleTarget,
               "openvz",
               "sclp",
               "sclplm",
+              "isa-debug",
 );
 
 VIR_ENUM_IMPL(virDomainChrSerialTargetModel,
@@ -5382,7 +5383,7 @@ virDomainChrIsaSerialDefPostParse(virDomainDef *def)
 }
 
 
-static void
+static int
 virDomainChrDefPostParse(virDomainChrDef *chr,
                          const virDomainDef *def)
 {
@@ -5391,9 +5392,18 @@ virDomainChrDefPostParse(virDomainChrDef *chr,
 
     virDomainChrGetDomainPtrs(def, chr->deviceType, &arrPtr, &cnt);
 
-    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
-        chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE) {
-        chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
+    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE) {
+        switch (chr->targetType) {
+        case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE:
+            chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
+            break;
+        case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG:
+            if (!ARCH_IS_X86(def->os.arch)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("isa-debug console type only valid on x86 architecture"));
+                return -1;
+            }
+        }
     }
 
     if (chr->target.port == -1 &&
@@ -5409,6 +5419,8 @@ virDomainChrDefPostParse(virDomainChrDef *chr,
 
         chr->target.port = maxport + 1;
     }
+
+    return 0;
 }
 
 
@@ -5620,8 +5632,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:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e2f35fe20b..7f845b609d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1183,6 +1183,7 @@ typedef enum {
     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ,
     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP,
     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM,
+    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG,
 
     VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST
 } virDomainChrConsoleTargetType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 60b4f96e06..030c27b963 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10845,6 +10845,7 @@ qemuBuildConsoleChrDeviceProps(const virDomainDef *def,
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML:
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC:
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ:
+    case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_ISA_DEBUG:
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unsupported console target type %s"),
-- 
2.33.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux