Statistics
| Branch: | Revision:

root / hw / virtio-serial-bus.c @ 4040ab72

History | View | Annotate | Download (24.2 kB)

# Date Author Comment
fbe0c559 03/28/2011 07:34 pm Michael S. Tsirkin

virtio-serial: don't crash on invalid input

Fix crash on invalid input in virtio-serial.
Discovered by code review, untested.

Signed-off-by: Michael S. Tsirkin <>

e9b382b0 03/21/2011 01:25 pm Amit Shah

virtio-serial-bus: Simplify handle_output() function

There's no code change, just re-arrangement to simplify the function
after recent modifications.

Reported-by: Juan Quintela <>
Signed-off-by: Amit Shah <>

6b331efb 03/21/2011 01:25 pm Amit Shah

virtio-serial: Use a struct to pass config information from proxy

Instead of using a single variable to pass to the virtio_serial_init
function, use a struct so that expanding the number of variables to be
passed on later is easier.

Signed-off-by: Amit Shah <>

a43f9c90 02/24/2011 07:25 pm Gerd Hoffmann

virtio-serial: kill VirtIOSerialDevice

VirtIOSerialDevice is like VirtIOSerialPort with just the first two
fields, which makes it pretty pointless. Using VirtIOSerialPort
directly works equally well and is less confusing.

[Amit: - rebase
- rename 'dev' to 'port' in function params in virtio-serial.h ]...

7185f931 02/04/2011 02:33 pm Amit Shah

virtio-serial: Make sure virtqueue is ready before discarding data

This can happen if a port gets unplugged before guest has chance to
initialise vqs.

Reported-by: Juan Quintela <>
Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

e54b7f52 02/01/2011 11:20 pm Anthony Liguori

Merge remote branch 'amit/for-anthony' into staging

f1925dff 01/20/2011 11:08 am Amit Shah

virtio-serial: Add support for flow control

This commit lets apps signal an incomplete write. When that happens,
stop sending out any more data to the app and wait for it to unthrottle
the port.

Signed-off-by: Amit Shah <>

37f95bf3 01/20/2011 11:08 am Amit Shah

virtio-serial: save/restore new fields in port struct

The new fields that got added as part of not copying over the guest
buffer to the host need to be saved/restored across migration. Do that
and bump up the version number.

Signed-off-by: Amit Shah <>

471344db 01/20/2011 11:08 am Amit Shah

virtio-serial: Don't copy over guest buffer to host

When the guest writes something to a host, we copied over the entire
buffer first into the host and then processed it. Do away with that, it
could result in a malicious guest causing a DoS on the host....

6bff8656 01/20/2011 11:07 am Amit Shah

virtio-serial: move out discard logic in a separate function

Instead of combining flush logic into the discard case and not discard
case, have one function doing discard case. This will help later when
adding flow control logic to the do_flush_queued_data() function....

a01a9cb8 01/12/2011 05:55 pm Amit Shah

virtio-serial-bus: bump up control vq size to 32

The current default of 16 buffers for the control vq is too small. We
can get more entries in there, for example when asking the guest to add
max. allowed ports.

Note: a more robust solution would involve some kind of event queueing...

8b53a865 08/23/2010 12:19 am Amit Shah

virtio-serial: Cleanup on device hot-unplug

Free malloc'ed memory, unregister from savevm and clean up virtio-common
bits on device hot-unplug.

This was found performing a migration after device hot-unplug.

Reported-by: <>
Signed-off-by: Amit Shah <>...

5ab4bb59 07/30/2010 11:59 pm Amit Shah

virtio-serial: Check if more max_ports specified than we can handle

Currently virtio-serial supports a maximum of 31 ports. Specifying the
'max_ports' parameter to be > 31 on the cmd line causes badness.

Ensure we initialise virtio-serial only if max_ports is within the...

6b611d3a 07/13/2010 05:06 pm Amit Shah

virtio-serial: Check if virtio queue is ready before consuming data

If a virtio-serial port is removed before the guest comes up and
initialises the virtqueues, qemu exits with the message

Guest moved used index from 0 to 61440

This happens because we try to clear any pending buffers from the...

fd11a78b 07/13/2010 05:06 pm Amit Shah

virtio-serial: Assert for virtio queue ready before virtqueue operations

In addition to the previous fix for calling do_flush_queued_data() only
when the virtqueue is ready, ensure do_flush_queued_data() gets a vq
that's suitably initialised.

Signed-off-by: Amit Shah <>...

0be71e32 07/06/2010 06:36 pm Alex Williamson

savevm: Add DeviceState param

When available, we'd like to be able to access the DeviceState
when registering a savevm. For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.

Signed-off-by: Alex Williamson <>...

f83ccb3e 06/30/2010 09:38 pm Markus Armbruster

virtio-serial: Simplify virtio_serial_load()

For all i, ports_map[i] is used in and only in the i-th iteration.
Replace the dynamic array by a scalar variable.

Signed-off-by: Markus Armbruster <>
Acked-by: Amit Shah <>...

a132a679 06/01/2010 08:53 pm Alon Levy

virtio-serial-bus: fix ports_map allocation on init

Fix for too small allocation to ports_map

Signed-off-by: Alon Levy <>
Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

a1c59752 05/03/2010 08:09 pm Amit Shah

virtio-serial: Fix check for 'assert'; prevent NULL derefs

In the flush_queued_data() function, we expect port to be valid. Assert
only for port and not port || discard.

Reported-by: Juan Quintela <>
Signed-off-by: Amit Shah <>...

e4d5639d 04/28/2010 04:58 pm Amit Shah

iov: Introduce a new file for helpers around iovs, add iov_from_buf()

The virtio-net code uses iov_fill() which fills an iov from a linear
buffer. The virtio-serial-bus code does something similar in an
open-coded function.

Create a new iov.c file that has iov_from_buf()....

e61da14d 04/28/2010 04:58 pm Amit Shah

virtio-serial: Handle scatter-gather buffers for control messages

Current control messages are small enough to not be split into multiple
buffers but we could run into such a situation in the future or a
malicious guest could cause such a situation.

So handle the entire iov request for control messages....

e85ba9b2 04/28/2010 04:58 pm Amit Shah

virtio-serial: Handle scatter/gather input from the guest

Current guests don't send more than one iov but it can change later.
Ensure we handle that case.

Signed-off-by: Amit Shah <>
CC: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

1e4476aa 04/28/2010 04:58 pm Amit Shah

virtio-serial: Apps should consume all data that guest sends out / Fix virtio api abuse

We cannot indicate to the guest how much data was consumed by an app for
out_bufs. So we just have to assume the apps will consume all the data
that are handed over to them....

a69c7600 04/28/2010 04:58 pm Amit Shah

virtio-serial: Discard data that guest sends us when ports aren't connected

Before the earlier patch, we relied on incorrect virtio api usage to
signal to the guest that a particular buffer wasn't consumed by the
host.

After fixing that, we now just discard the data the guest sends us while...

9ed7b059 04/28/2010 04:58 pm Amit Shah

virtio-serial: Implement flow control for individual ports

Individual ports can now signal to the virtio-serial core to stop
sending data if the ports cannot immediately handle new data. When a
port later unthrottles, any data queued up in the virtqueue are sent to...

e245795b 04/28/2010 04:58 pm Amit Shah

virtio-serial: save/load: Ensure target has enough ports

The target could be started with max_nr_ports for a virtio-serial device
lesser than what was available on the source machine. Fail the migration
in such a case.

Signed-off-by: Amit Shah <>...

295587f7 04/28/2010 04:58 pm Amit Shah

virtio-serial: save/load: Ensure nr_ports on src and dest are same.

The number of ports on the source as well as the destination machines
should match. If they don't, it means some ports that got hotplugged on
the source aren't instantiated on the destination. Or that ports that...

16af2e3c 04/28/2010 04:58 pm Amit Shah

virtio-serial: save/load: Ensure we have hot-plugged ports instantiated

If some ports that were hot-plugged on the source are not available on
the destination, fail migration instead of trying to deref a NULL
pointer.

Signed-off-by: Amit Shah <>...

31abe21f 04/28/2010 04:58 pm Amit Shah

virtio-serial: save/load: Send target host connection status if different

If the host connection to a port is closed on the destination machine
after migration, whereas the connection was open on the source, the
guest has to be informed of that.

Similar for a host connection open on the destination....

055b889f 04/28/2010 04:58 pm Amit Shah

virtio-serial: Use control messages to notify guest of new ports

Allow the port 'id's to be set by a user on the command line. This is
needed by management apps that will want a stable port numbering scheme
for hot-plug/unplug and migration.

Since the port numbers are shared with the guest (to identify ports in...

306eb457 04/28/2010 04:58 pm Amit Shah

virtio-serial: whitespace: match surrounding code

The virtio-serial code doesn't mix declarations and definitions, so
separate them out on different lines.

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

e30f328c 04/28/2010 04:58 pm Amit Shah

virtio-serial: Remove redundant check for 0-sized write request

The check for a 0-sized write request to a guest port is not necessary;
the while loop below won't be executed in this case and all will be
fine.

Signed-off-by: Amit Shah <>...

71c092e9 04/28/2010 04:58 pm Amit Shah

virtio-serial: Update copyright year to 2010

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

4048c7c3 04/28/2010 04:58 pm Amit Shah

virtio-serial: Propagate errors in initialising ports / devices in guest

If adding of ports or devices in the guest fails we can send out a QMP
event so that management software can deal with it.

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

3ecb45f8 04/28/2010 04:58 pm Amit Shah

virtio-serial: Send out guest data to ports only if port is opened

Data should be written only when ports are open.

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

1ecda02b 03/16/2010 05:58 pm Markus Armbruster

error: Replace qemu_error() by error_report()

error_report() terminates the message with a newline. Strip it it
from its arguments.

This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for...

ee4d45be 02/19/2010 11:32 pm Michael S. Tsirkin

virtio-serial: don't set MULTIPORT for 1 port dev

Since commit 98b19252cf1bd97c54bc4613f3537c5ec0aae263, all
serial devices declare MULTIPORT feature.
To allow 0.12 compatibility, we should clear this when
max_nr_ports is 1.

Signed-off-by: Michael S. Tsirkin <>...

9ae84f0a 01/29/2010 05:53 pm Amit Shah

virtio-serial-bus: Fix bus initialisation and allow for bus identification

This commit enables one to use multiple virtio-serial devices and to
assign ports to arbitrary devices like this:

-device virtio-serial,id=foo -device virtio-serial,id=bar \
-device virtserialport,bus=foo.0,name=foo \...
98b19252 01/20/2010 04:25 pm Amit Shah

virtio-console: qdev conversion, new virtio-serial-bus

This commit converts the virtio-console device to create a new
virtio-serial bus that can host console and generic serial ports. The
file hosting this code is now called virtio-serial-bus.c.

The virtio console is now a very simple qdev device that sits on the...

6663a195 01/20/2010 04:25 pm Amit Shah

virtio-serial-bus: Maintain guest and host port open/close state

Via control channel messages, the guest can tell us whether a port got
opened or closed. Similarly, we can also indicate to the guest of host
port open/close events.

Signed-off-by: Amit Shah <>...

160600fd 01/20/2010 04:25 pm Amit Shah

virtio-serial-bus: Add a port 'name' property for port discovery in guests

The port 'id' or number is internal state between the guest kernel and
our bus implementation. This is invocation-dependent and isn't part of
the guest-host ABI.

To correcly enumerate and map ports between the host and the guest, the...

f146ec9a 01/20/2010 04:25 pm Amit Shah

virtio-serial-bus: Add ability to hot-unplug ports

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>