[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 13/34] test/qgraph: virtio_start_device funct
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH v2 13/34] test/qgraph: virtio_start_device function |
Date: |
Thu, 9 Aug 2018 15:39:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 06/08/2018 16:33, Emanuele Giuseppe Esposito wrote:
> This function is intended to group all the qvirtio_* functions that
> start the qvirtio devices.
> Applied in all tests using this combination of functions.
>
> Signed-off-by: Emanuele Giuseppe Esposito <address@hidden>
> ---
> tests/libqos/virtio.c | 8 ++++++++
> tests/libqos/virtio.h | 1 +
> tests/vhost-user-test.c | 5 +----
> tests/virtio-9p-test.c | 6 +-----
> tests/virtio-blk-test.c | 18 ++----------------
> tests/virtio-net-test.c | 6 +-----
> tests/virtio-scsi-test.c | 4 +---
> 7 files changed, 15 insertions(+), 33 deletions(-)
>
> diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
> index 0dad5c19ac..56007ef11b 100644
> --- a/tests/libqos/virtio.c
> +++ b/tests/libqos/virtio.c
> @@ -365,3 +365,11 @@ const char *qvirtio_get_dev_type(void)
> return "pci";
> }
> }
> +
> +void qvirtio_start_device(QVirtioDevice *vdev)
> +{
> + qvirtio_reset(vdev);
> + qvirtio_set_acknowledge(vdev);
> + qvirtio_set_driver(vdev);
> + qvirtio_set_driver_ok(vdev);
I'm not sure you can put qvirtio_set_driver_ok() here.
qvirtio_set_driver_ok() must be called when the driver is OK, it means
that the virtio device must be fully initialized before (features,
virtqueue, MSI, ...).
http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.pdf
3.1.1 Driver Requirements: Device Initialization
The driver MUST follow this sequence to initialize a device:
1. Reset the device.
2. Set the ACKNOWLEDGE status bit: the guest OS has notice the device.
3. Set the DRIVER status bit: the guest OS knows how to drive the device.
4. Read device feature bits, and write the subset of feature bits
understood by the OS and driver to the
device. During this step the driver MAY read (but MUST NOT write) the
device-specific configuration
fields to check that it can support the device before accepting it.
5. Set the FEATURES_OK status bit. The driver MUST NOT accept new
feature bits after this step.
6. Re-read device status to ensure the FEATURES_OK bit is still set:
otherwise, the device does not
support our subset of features and the device is unusable.
7. Perform device-specific setup, including discovery of virtqueues for
the device, optional per-bus setup,
reading and possibly writing the device’s virtio configuration space,
and population of virtqueues.
8. Set the DRIVER_OK status bit. At this point the device is “live”.
Thanks,
Laurent
- [Qemu-devel] [PATCH v2 10/34] tests/qgraph: ppc64/pseries machine node, (continued)
- [Qemu-devel] [PATCH v2 11/34] test/qgraph: e1000e driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 01/34] tests: qgraph API for the qtest driver framework, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 12/34] test/qgraph: e1000e-test node, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 13/34] test/qgraph: virtio_start_device function, Emanuele Giuseppe Esposito, 2018/08/06
- Re: [Qemu-devel] [PATCH v2 13/34] test/qgraph: virtio_start_device function,
Laurent Vivier <=
- [Qemu-devel] [PATCH v2 15/34] tests/qgraph: rename qvirtio_mmio_init_device functions, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 16/34] test/qgraph: virtio-mmio driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 17/34] test/qgraph: arm/virt machine node, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 14/34] test/qgraph: virtio-pci driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/06
- [Qemu-devel] [PATCH v2 18/34] tests: virtio: separate ccw tests from libqos, Emanuele Giuseppe Esposito, 2018/08/06