diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-09-13 13:34:37 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-09-17 15:14:24 +0000 |
commit | 4e1837f855b88fdced2941b17509e13b0c8fa518 (patch) | |
tree | 55a661085c835405fed67c2d2731b62417d8addf /hw | |
parent | 689d7e2fadb27d696528eb1f86eb3e3e19e07761 (diff) |
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio.c | 10 | ||||
-rw-r--r-- | hw/virtio.h | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/hw/virtio.c b/hw/virtio.c index 13aa0faf27..946d911580 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -498,6 +498,16 @@ void virtio_update_irq(VirtIODevice *vdev) 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) { VirtIODevice *vdev = opaque; diff --git a/hw/virtio.h b/hw/virtio.h index 4d20d9b8f4..2d18209fb2 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -135,14 +135,6 @@ struct VirtIODevice 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, void (*handle_output)(VirtIODevice *, VirtQueue *)); @@ -190,6 +182,7 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n); void virtio_queue_notify(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_set_status(VirtIODevice *vdev, uint8_t val); void virtio_reset(void *opaque); void virtio_update_irq(VirtIODevice *vdev); |