History | View | Annotate | Download (21.6 kB)
virtio-serial: Cleanup on device hot-unplug
Free malloc'ed memory, unregister from savevm and clean up virtio-commonbits on device hot-unplug.
This was found performing a migration after device hot-unplug.
Reported-by: <lihuang@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>...
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...
virtio-serial: Check if virtio queue is ready before consuming data
If a virtio-serial port is removed before the guest comes up andinitialises 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...
virtio-serial: Assert for virtio queue ready before virtqueue operations
In addition to the previous fix for calling do_flush_queued_data() onlywhen the virtqueue is ready, ensure do_flush_queued_data() gets a vqthat's suitably initialised.
Signed-off-by: Amit Shah <amit.shah@redhat.com>...
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
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 <armbru@redhat.com>Acked-by: Amit Shah <amit.shah@redhat.com>...
virtio-serial-bus: fix ports_map allocation on init
Fix for too small allocation to ports_map
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-serial: Fix check for 'assert'; prevent NULL derefs
In the flush_queued_data() function, we expect port to be valid. Assertonly for port and not port || discard.
Reported-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>...
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 linearbuffer. The virtio-serial-bus code does something similar in anopen-coded function.
Create a new iov.c file that has iov_from_buf()....
virtio-serial: Handle scatter-gather buffers for control messages
Current control messages are small enough to not be split into multiplebuffers but we could run into such a situation in the future or amalicious guest could cause such a situation.
So handle the entire iov request for control messages....
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 <amit.shah@redhat.com>CC: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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 forout_bufs. So we just have to assume the apps will consume all the datathat are handed over to them....
virtio-serial: Discard data that guest sends us when ports aren't connected
Before the earlier patch, we relied on incorrect virtio api usage tosignal to the guest that a particular buffer wasn't consumed by thehost.
After fixing that, we now just discard the data the guest sends us while...
virtio-serial: Implement flow control for individual ports
Individual ports can now signal to the virtio-serial core to stopsending data if the ports cannot immediately handle new data. When aport later unthrottles, any data queued up in the virtqueue are sent to...
virtio-serial: save/load: Ensure target has enough ports
The target could be started with max_nr_ports for a virtio-serial devicelesser than what was available on the source machine. Fail the migrationin such a case.
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 machinesshould match. If they don't, it means some ports that got hotplugged onthe source aren't instantiated on the destination. Or that ports that...
virtio-serial: save/load: Ensure we have hot-plugged ports instantiated
If some ports that were hot-plugged on the source are not available onthe destination, fail migration instead of trying to deref a NULLpointer.
virtio-serial: save/load: Send target host connection status if different
If the host connection to a port is closed on the destination machineafter migration, whereas the connection was open on the source, theguest has to be informed of that.
Similar for a host connection open on the destination....
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 isneeded by management apps that will want a stable port numbering schemefor hot-plug/unplug and migration.
Since the port numbers are shared with the guest (to identify ports in...
virtio-serial: whitespace: match surrounding code
The virtio-serial code doesn't mix declarations and definitions, soseparate them out on different lines.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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 befine.
virtio-serial: Update copyright year to 2010
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 QMPevent so that management software can deal with it.
virtio-serial: Send out guest data to ports only if port is opened
Data should be written only when ports are open.
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
virtio-serial: don't set MULTIPORT for 1 port dev
Since commit 98b19252cf1bd97c54bc4613f3537c5ec0aae263, allserial devices declare MULTIPORT feature.To allow 0.12 compatibility, we should clear this whenmax_nr_ports is 1.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
virtio-serial-bus: Fix bus initialisation and allow for bus identification
This commit enables one to use multiple virtio-serial devices and toassign ports to arbitrary devices like this:
-device virtio-serial,id=foo -device virtio-serial,id=bar \ -device virtserialport,bus=foo.0,name=foo \...
virtio-console: qdev conversion, new virtio-serial-bus
This commit converts the virtio-console device to create a newvirtio-serial bus that can host console and generic serial ports. Thefile hosting this code is now called virtio-serial-bus.c.
The virtio console is now a very simple qdev device that sits on the...
virtio-serial-bus: Maintain guest and host port open/close state
Via control channel messages, the guest can tell us whether a port gotopened or closed. Similarly, we can also indicate to the guest of hostport open/close events.
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 andour bus implementation. This is invocation-dependent and isn't part ofthe guest-host ABI.
To correcly enumerate and map ports between the host and the guest, the...
virtio-serial-bus: Add ability to hot-unplug ports