Skip to contentSkip to conversation

question on virtio ccw

Qemu-devel Michael S. Tsirkin 2 participants 2 messages Dec 7, 2017 – Dec 8, 2017

lore
Share & tools
lore
#0 lore raw

I see this in ccw in qemu:

            if (virtio_set_status(vdev, status) == 0) {
                if (vdev->status == 0) {
                    virtio_ccw_reset_virtio(dev, vdev);
                }
                if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
                    virtio_ccw_start_ioeventfd(dev);
                }
                sch->curr_status.scsw.count = ccw.count - sizeof(status);
                ret = 0;
            } else {
                /* Trigger a command reject. */
                ret = -ENOSYS;
            }

virtio_set_status on success sets vdev->status to status. Why check vdev->status in one place and status in another?

Signature · 1 line
MST
#1 lore raw
Quoted 16 lines · On Thu, 7 Dec 2017 19:18:44 +0200 "Michael S. Tsirkin" <[email protected]> wrote:

I see this in ccw in qemu:

            if (virtio_set_status(vdev, status) == 0) {
                if (vdev->status == 0) {
                    virtio_ccw_reset_virtio(dev, vdev);
                }
                if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
                    virtio_ccw_start_ioeventfd(dev);
                }
                sch->curr_status.scsw.count = ccw.count - sizeof(status);
                ret = 0;
            } else {
                /* Trigger a command reject. */
                ret = -ENOSYS;
            }
Quoted 3 lines

virtio_set_status on success sets vdev->status to status. Why check vdev->status in one place and status in another?

Probably for symmetry with the check whether to stop ioeventfd right above. But it does not really matter one way or the other.