diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-07-17 11:18:51 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-07-17 11:18:51 +0100 |
commit | 104369c8c7c116e7656ee6344d66ac872fd86143 (patch) | |
tree | a43ebde072dc408b8dbfe0b07f6a58dfb4afcb11 | |
parent | 5a7348045091a2bc15d85bb177e5956aa6114e5a (diff) | |
parent | 57d84cf35302fe51789c18354bf09a521bb603df (diff) |
Merge remote-tracking branch 'remotes/amit/for-2.1' into staging
* remotes/amit/for-2.1:
virtio-serial-bus: keep port 0 reserved for virtconsole even on unplug
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | hw/char/virtio-serial-bus.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 07bebc03ac..23123b730e 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -797,10 +797,18 @@ static void add_port(VirtIOSerial *vser, uint32_t port_id) static void remove_port(VirtIOSerial *vser, uint32_t port_id) { VirtIOSerialPort *port; - unsigned int i; - i = port_id / 32; - vser->ports_map[i] &= ~(1U << (port_id % 32)); + /* + * Don't mark port 0 removed -- we explicitly reserve it for + * backward compat with older guests, ensure a virtconsole device + * unplug retains the reservation. + */ + if (port_id) { + unsigned int i; + + i = port_id / 32; + vser->ports_map[i] &= ~(1U << (port_id % 32)); + } port = find_port_by_id(vser, port_id); /* |