trace: add virtio_set_status() trace event
The virtio device lifecycle can be observed by looking at the sequence of set status operations. This is especially important for catching the reset operation (status value 0), which resets the device and all virtqueues. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
689d7e2fad
commit
4e1837f855
10
hw/virtio.c
10
hw/virtio.c
@ -498,6 +498,16 @@ void virtio_update_irq(VirtIODevice *vdev)
|
|||||||
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
|
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void virtio_set_status(VirtIODevice *vdev, uint8_t val)
|
||||||
|
{
|
||||||
|
trace_virtio_set_status(vdev, val);
|
||||||
|
|
||||||
|
if (vdev->set_status) {
|
||||||
|
vdev->set_status(vdev, val);
|
||||||
|
}
|
||||||
|
vdev->status = val;
|
||||||
|
}
|
||||||
|
|
||||||
void virtio_reset(void *opaque)
|
void virtio_reset(void *opaque)
|
||||||
{
|
{
|
||||||
VirtIODevice *vdev = opaque;
|
VirtIODevice *vdev = opaque;
|
||||||
|
@ -135,14 +135,6 @@ struct VirtIODevice
|
|||||||
VMChangeStateEntry *vmstate;
|
VMChangeStateEntry *vmstate;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void virtio_set_status(VirtIODevice *vdev, uint8_t val)
|
|
||||||
{
|
|
||||||
if (vdev->set_status) {
|
|
||||||
vdev->set_status(vdev, val);
|
|
||||||
}
|
|
||||||
vdev->status = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
||||||
void (*handle_output)(VirtIODevice *,
|
void (*handle_output)(VirtIODevice *,
|
||||||
VirtQueue *));
|
VirtQueue *));
|
||||||
@ -190,6 +182,7 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n);
|
|||||||
void virtio_queue_notify(VirtIODevice *vdev, int n);
|
void virtio_queue_notify(VirtIODevice *vdev, int n);
|
||||||
uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);
|
uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);
|
||||||
void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector);
|
void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector);
|
||||||
|
void virtio_set_status(VirtIODevice *vdev, uint8_t val);
|
||||||
void virtio_reset(void *opaque);
|
void virtio_reset(void *opaque);
|
||||||
void virtio_update_irq(VirtIODevice *vdev);
|
void virtio_update_irq(VirtIODevice *vdev);
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ virtqueue_pop(void *vq, void *elem, unsigned int in_num, unsigned int out_num) "
|
|||||||
virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p"
|
virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p"
|
||||||
virtio_irq(void *vq) "vq %p"
|
virtio_irq(void *vq) "vq %p"
|
||||||
virtio_notify(void *vdev, void *vq) "vdev %p vq %p"
|
virtio_notify(void *vdev, void *vq) "vdev %p vq %p"
|
||||||
|
virtio_set_status(void *vdev, uint8_t val) "vdev %p val %u"
|
||||||
|
|
||||||
# hw/virtio-serial-bus.c
|
# hw/virtio-serial-bus.c
|
||||||
virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
|
virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
|
||||||
|
Loading…
Reference in New Issue
Block a user