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

[libvirt] [PATCH 1/2] conf: add debugcon-isa chardev guest interface



This interface can be used for example by firmware to print
debug messages. Here is domain xml example:

    <channel type='file'>
      <source path='/var/log/libvirt/qemu/VM.firmware.log'/>
      <target type='debugcon-isa'/>
      <address type='isa' iobase='0x402'/>
    </channel>

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy virtuozzo com>
---
 docs/formatdomain.html.in                         | 11 ++++++
 docs/schemas/domaincommon.rng                     |  8 +++++
 src/conf/domain_conf.c                            |  6 +++-
 src/conf/domain_conf.h                            |  1 +
 src/qemu/qemu_command.c                           |  3 ++
 tests/qemuxml2argvdata/channel-debugcon-isa.xml   | 34 +++++++++++++++++++
 tests/qemuxml2xmloutdata/channel-debugcon-isa.xml | 41 +++++++++++++++++++++++
 tests/qemuxml2xmltest.c                           |  1 +
 8 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/channel-debugcon-isa.xml
 create mode 100644 tests/qemuxml2xmloutdata/channel-debugcon-isa.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7f07bb7..b760a9a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7305,6 +7305,12 @@ qemu-kvm -net nic,model=? /dev/null
   &lt;channel type='spicevmc'&gt;
     &lt;target type='virtio' name='com.redhat.spice.0'/&gt;
   &lt;/channel&gt;
+
+  &lt;channel type='file'&gt;
+    &lt;source path='/var/log/libvirt/qemu/VM.firmware.log'/&gt;
+    &lt;target type='debugcon-isa'/&gt;
+    &lt;address type='isa' iobase='0x402'/&gt;
+  &lt;/channel&gt;
 &lt;/devices&gt;
 ...</pre>
 
@@ -7369,6 +7375,11 @@ qemu-kvm -net nic,model=? /dev/null
         optional <code>address</code> element can tie the channel to a
         particular <code>type='virtio-serial'</code> controller.
         <span class="since">Since 0.8.8</span></dd>
+      <dt><code>debugcon-isa</code></dt>
+      <dd>
+        Debug console on isa bus. Address on bus is given by optional
+        <code>address</code> element.
+        <span class="since">Since 5.1.0</span></dd>
     </dl>
 
     <h5><a id="elementsCharHostInterface">Host interface</a></h5>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index aa50eac..595f073 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4150,6 +4150,13 @@
       </optional>
     </element>
   </define>
+  <define name="debugconIsaTarget">
+    <element name="target">
+      <attribute name="type">
+        <value>debugcon-isa</value>
+      </attribute>
+    </element>
+  </define>
   <define name="channel">
     <element name="channel">
       <ref name="qemucdevSrcType"/>
@@ -4159,6 +4166,7 @@
           <ref name="guestfwdTarget"/>
           <ref name="virtioTarget"/>
           <ref name="xenTarget"/>
+          <ref name="debugconIsaTarget"/>
         </choice>
         <optional>
           <ref name="alias"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f3d541b..af41e4e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -458,7 +458,8 @@ VIR_ENUM_IMPL(virDomainChrChannelTarget,
               "none",
               "guestfwd",
               "virtio",
-              "xen")
+              "xen",
+              "debugcon-isa")
 
 VIR_ENUM_IMPL(virDomainChrConsoleTarget,
               VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
@@ -17230,6 +17231,9 @@ virDomainChrEquals(virDomainChrDefPtr src,
                           sizeof(*src->target.addr)) == 0;
             break;
 
+        case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_DEBUGCON_ISA:
+            break;
+
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE:
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST:
             /* shouldn't happen */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7776a3a..7319494 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1106,6 +1106,7 @@ typedef enum {
     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN,
+    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_DEBUGCON_ISA,
 
     VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST
 } virDomainChrChannelTargetType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2fb7d32..e96b1a0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10787,6 +10787,9 @@ qemuBuildChannelChrDeviceStr(char **deviceStr,
             goto cleanup;
         break;
 
+    case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_DEBUGCON_ISA:
+        break;
+
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE:
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST:
diff --git a/tests/qemuxml2argvdata/channel-debugcon-isa.xml b/tests/qemuxml2argvdata/channel-debugcon-isa.xml
new file mode 100644
index 0000000..d2d4904
--- /dev/null
+++ b/tests/qemuxml2argvdata/channel-debugcon-isa.xml
@@ -0,0 +1,34 @@
+<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'/>
+    <channel type='pipe'>
+      <source path='/tmp/debugcon-isa'/>
+      <target type='debugcon-isa'/>
+      <address type='isa' iobase='0x402'/>
+    </channel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/channel-debugcon-isa.xml b/tests/qemuxml2xmloutdata/channel-debugcon-isa.xml
new file mode 100644
index 0000000..bff97f5
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/channel-debugcon-isa.xml
@@ -0,0 +1,41 @@
+<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'/>
+    <channel type='pipe'>
+      <source path='/tmp/debugcon-isa'/>
+      <target type='debugcon-isa'/>
+      <address type='isa' iobase='0x402'/>
+    </channel>
+    <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 82e2c0e..dde2332 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -464,6 +464,7 @@ mymain(void)
     DO_TEST("channel-guestfwd", NONE);
     DO_TEST("channel-virtio", NONE);
     DO_TEST("channel-virtio-state", NONE);
+    DO_TEST("channel-debugcon-isa", NONE);
 
     DO_TEST_FULL("channel-unix-source-path", WHEN_INACTIVE, GIC_NONE, NONE);
 
-- 
1.8.3.1


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