]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Introduce pci-serial
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 6 May 2015 15:42:41 +0000 (17:42 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 21 May 2015 15:49:02 +0000 (17:49 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=998813

Like usb-serial, the pci-serial device allows a serial device to be
attached to PCI bus. An example XML looks like this:

  <serial type='dev'>
    <source path='/dev/ttyS2'/>
    <target type='pci-serial' port='0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </serial>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
tests/qemuxml2argvdata/qemuxml2argv-pci-serial-dev-chardev.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

index eb3aacd4365d7e804d7656bd030f0926c7781bcc..6d58a40064c5cd43d062e6189a2dcf83c2fe1265 100644 (file)
@@ -5107,12 +5107,16 @@ qemu-kvm -net nic,model=? /dev/null
       specifies the port number. Ports are numbered starting from 0. There are
       usually 0, 1 or 2 serial ports. There is also an optional
       <code>type</code> attribute <span class="since">since 1.0.2</span>
-      which has two choices for its value, one is <code>isa-serial</code>,
-      the other is <code>usb-serial</code>. If <code>type</code> is missing,
-      <code>isa-serial</code> will be used by default. For <code>usb-serial</code>
-      an optional sub-element <code>&lt;address&gt;</code> with
-      <code>type='usb'</code> can tie the device to a particular controller,
-      <a href="#elementsAddress">documented above</a>.
+      which has three choices for its value, one is <code>isa-serial</code>,
+      then <code>usb-serial</code> and last one is <code>pci-serial</code>.
+      If <code>type</code> is missing, <code>isa-serial</code> will be used by
+      default. For <code>usb-serial</code> an optional sub-element
+      <code>&lt;address/&gt;</code> with <code>type='usb'</code> can tie the
+      device to a particular controller, <a href="#elementsAddress">documented above</a>.
+      Similarly, <code>pci-serial</code> can be used to attach the device to
+      the pci bus (<span class="since">since 1.2.16</span>). Again, it has
+      optional sub-element <code>&lt;address/&gt;</code> with
+      <code>type='pci'</code> to select desired location on the PCI bus.
     </p>
 
     <h6><a name="elementCharConsole">Console</a></h6>
index 64a094b5ad1c49258a21b21b7a0af739ee1dd7fc..7c6fa5cd6fe86a57102ffb50b525d8a8a18ce20a 100644 (file)
       <choice>
         <value>isa-serial</value>
         <value>usb-serial</value>
+        <value>pci-serial</value>
       </choice>
     </attribute>
   </define>
index 892d7d77ee0d93ebc812cb575044b53349903c16..631f9ebe034e854b34fea2dfd3b0b08ca0bc6c34 100644 (file)
@@ -408,7 +408,8 @@ VIR_ENUM_IMPL(virDomainChrDeviceState, VIR_DOMAIN_CHR_DEVICE_STATE_LAST,
 VIR_ENUM_IMPL(virDomainChrSerialTarget,
               VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST,
               "isa-serial",
-              "usb-serial")
+              "usb-serial",
+              "pci-serial")
 
 VIR_ENUM_IMPL(virDomainChrChannelTarget,
               VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
index f27f2e481446b5e2f056480671b126d8cff20643..0fcf52e3957fdac2e6f747961740bdae43963d38 100644 (file)
@@ -1068,6 +1068,7 @@ typedef enum {
 typedef enum {
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA = 0,
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB,
+    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI,
 
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
 } virDomainChrSerialTargetType;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-serial-dev-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-serial-dev-chardev.xml
new file mode 100644 (file)
index 0000000..a058e38
--- /dev/null
@@ -0,0 +1,37 @@
+<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'>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</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='dev'>
+      <source path='/dev/ttyS2'/>
+      <target type='pci-serial' port='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </serial>
+    <console type='dev'>
+      <source path='/dev/ttyS2'/>
+      <target type='serial' port='0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </console>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
index 2c53d7c1a1ae3c954c96889092ef126e68750654..53bcc9f3520c6c480333698bef338ac8f7b41881 100644 (file)
@@ -481,6 +481,7 @@ mymain(void)
     DO_TEST("hostdev-pci-address");
     DO_TEST("hostdev-vfio");
     DO_TEST("pci-rom");
+    DO_TEST("pci-serial-dev-chardev");
 
     DO_TEST("encrypted-disk");
     DO_TEST_DIFFERENT("memtune");