1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

Introduce pci-serial

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>
This commit is contained in:
Michal Privoznik 2015-05-06 17:42:41 +02:00
parent a5c2d1988e
commit 335b834d95
6 changed files with 52 additions and 7 deletions

View 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>

View File

@ -3076,6 +3076,7 @@
<choice>
<value>isa-serial</value>
<value>usb-serial</value>
<value>pci-serial</value>
</choice>
</attribute>
</define>

View 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,

View 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;

View File

@ -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>

View 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");