Revision 43997225 hw/virtio-serial-bus.c

b/hw/virtio-serial-bus.c
528 528
    memcpy(&config, config_data, sizeof(config));
529 529
}
530 530

  
531
static void guest_reset(VirtIOSerial *vser)
532
{
533
    VirtIOSerialPort *port;
534
    VirtIOSerialPortClass *vsc;
535

  
536
    QTAILQ_FOREACH(port, &vser->ports, next) {
537
        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
538
        if (port->guest_connected) {
539
            port->guest_connected = false;
540

  
541
            if (vsc->guest_close)
542
                vsc->guest_close(port);
543
        }
544
    }
545
}
546

  
531 547
static void set_status(VirtIODevice *vdev, uint8_t status)
532 548
{
533 549
    VirtIOSerial *vser;
......
546 562
         */
547 563
        port->guest_connected = true;
548 564
    }
565
    if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) {
566
        guest_reset(vser);
567
    }
568
}
569

  
570
static void vser_reset(VirtIODevice *vdev)
571
{
572
    VirtIOSerial *vser;
573

  
574
    vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
575
    guest_reset(vser);
549 576
}
550 577

  
551 578
static void virtio_serial_save(QEMUFile *f, void *opaque)
......
918 945
    vser->vdev.get_config = get_config;
919 946
    vser->vdev.set_config = set_config;
920 947
    vser->vdev.set_status = set_status;
948
    vser->vdev.reset = vser_reset;
921 949

  
922 950
    vser->qdev = dev;
923 951

  

Also available in: Unified diff