From: Sergio Lopez <slp@redhat.com>
To: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v2 3/7] libqos: pass full QVirtQueue to set_queue_address()
Date: Fri, 11 Oct 2019 14:22:44 +0200 [thread overview]
Message-ID: <871rvjcvzf.fsf@redhat.com> (raw)
In-Reply-To: <20191011085611.4194-4-stefanha@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3439 bytes --]
Stefan Hajnoczi <stefanha@redhat.com> writes:
> Instead of just passing the vring page frame number, pass the full
> QVirtQueue. This will allow the VIRTIO 1.0 transport to program the
> fine-grained vring address registers in the future.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> tests/libqos/virtio.h | 2 +-
> tests/libqos/virtio-mmio.c | 6 ++++--
> tests/libqos/virtio-pci.c | 6 ++++--
> 3 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h
> index 2cb2448f46..37f55b6ade 100644
> --- a/tests/libqos/virtio.h
> +++ b/tests/libqos/virtio.h
> @@ -79,7 +79,7 @@ struct QVirtioBus {
> uint16_t (*get_queue_size)(QVirtioDevice *d);
>
> /* Set the address of the selected queue */
> - void (*set_queue_address)(QVirtioDevice *d, uint32_t pfn);
> + void (*set_queue_address)(QVirtioDevice *d, QVirtQueue *vq);
>
> /* Setup the virtqueue specified by index */
> QVirtQueue *(*virtqueue_setup)(QVirtioDevice *d, QGuestAllocator *alloc,
> diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c
> index d0047876a8..43ca4e49c1 100644
> --- a/tests/libqos/virtio-mmio.c
> +++ b/tests/libqos/virtio-mmio.c
> @@ -127,9 +127,11 @@ static uint16_t qvirtio_mmio_get_queue_size(QVirtioDevice *d)
> return (uint16_t)qtest_readl(dev->qts, dev->addr + QVIRTIO_MMIO_QUEUE_NUM_MAX);
> }
>
> -static void qvirtio_mmio_set_queue_address(QVirtioDevice *d, uint32_t pfn)
> +static void qvirtio_mmio_set_queue_address(QVirtioDevice *d, QVirtQueue *vq)
> {
> QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
> + uint64_t pfn = vq->desc / dev->page_size;
> +
> qtest_writel(dev->qts, dev->addr + QVIRTIO_MMIO_QUEUE_PFN, pfn);
> }
>
> @@ -162,7 +164,7 @@ static QVirtQueue *qvirtio_mmio_virtqueue_setup(QVirtioDevice *d,
>
> addr = guest_alloc(alloc, qvring_size(vq->size, dev->page_size));
> qvring_init(dev->qts, alloc, vq, addr);
> - qvirtio_mmio_set_queue_address(d, vq->desc / dev->page_size);
> + qvirtio_mmio_set_queue_address(d, vq);
>
> return vq;
> }
> diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
> index c8d736f4d1..4772239b61 100644
> --- a/tests/libqos/virtio-pci.c
> +++ b/tests/libqos/virtio-pci.c
> @@ -190,9 +190,11 @@ static uint16_t qvirtio_pci_get_queue_size(QVirtioDevice *d)
> return qpci_io_readw(dev->pdev, dev->bar, VIRTIO_PCI_QUEUE_NUM);
> }
>
> -static void qvirtio_pci_set_queue_address(QVirtioDevice *d, uint32_t pfn)
> +static void qvirtio_pci_set_queue_address(QVirtioDevice *d, QVirtQueue *vq)
> {
> QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev);
> + uint64_t pfn = vq->desc / VIRTIO_PCI_VRING_ALIGN;
> +
> qpci_io_writel(dev->pdev, dev->bar, VIRTIO_PCI_QUEUE_PFN, pfn);
> }
>
> @@ -229,7 +231,7 @@ static QVirtQueue *qvirtio_pci_virtqueue_setup(QVirtioDevice *d,
> addr = guest_alloc(alloc, qvring_size(vqpci->vq.size,
> VIRTIO_PCI_VRING_ALIGN));
> qvring_init(qvpcidev->pdev->bus->qts, alloc, &vqpci->vq, addr);
> - qvirtio_pci_set_queue_address(d, vqpci->vq.desc / VIRTIO_PCI_VRING_ALIGN);
> + qvirtio_pci_set_queue_address(d, &vqpci->vq);
>
> return &vqpci->vq;
> }
Reviewed-by: Sergio Lopez <slp@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2019-10-11 12:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 8:56 [PATCH v2 0/7] libqos: add VIRTIO PCI 1.0 support Stefan Hajnoczi
2019-10-11 8:56 ` [PATCH v2 1/7] libqos: extract Legacy virtio-pci.c code Stefan Hajnoczi
2019-10-11 12:20 ` Sergio Lopez
2019-10-16 12:04 ` Thomas Huth
2019-10-11 8:56 ` [PATCH v2 2/7] libqos: add iteration support to qpci_find_capability() Stefan Hajnoczi
2019-10-11 12:22 ` Sergio Lopez
2019-10-16 12:12 ` Thomas Huth
2019-10-11 8:56 ` [PATCH v2 3/7] libqos: pass full QVirtQueue to set_queue_address() Stefan Hajnoczi
2019-10-11 12:22 ` Sergio Lopez [this message]
2019-10-16 12:15 ` Thomas Huth
2019-10-11 8:56 ` [PATCH v2 4/7] libqos: add MSI-X callbacks to QVirtioPCIDevice Stefan Hajnoczi
2019-10-11 12:23 ` Sergio Lopez
2019-10-17 13:25 ` Thomas Huth
2019-10-11 8:56 ` [PATCH v2 5/7] libqos: expose common virtqueue setup/cleanup functions Stefan Hajnoczi
2019-10-11 12:23 ` Sergio Lopez
2019-10-17 14:13 ` Thomas Huth
2019-10-11 8:56 ` [PATCH v2 6/7] libqos: make the virtio-pci BAR index configurable Stefan Hajnoczi
2019-10-11 12:06 ` Sergio Lopez
2019-10-14 9:52 ` Stefan Hajnoczi
2019-10-14 10:46 ` Sergio Lopez
2019-10-17 14:27 ` Thomas Huth
2019-10-11 8:56 ` [PATCH v2 7/7] libqos: add VIRTIO PCI 1.0 support Stefan Hajnoczi
2019-10-11 12:24 ` Sergio Lopez
2019-10-17 14:52 ` Thomas Huth
2019-10-17 16:07 ` Stefan Hajnoczi
2019-10-17 16:18 ` Thomas Huth
2019-10-18 6:48 ` Thomas Huth
2019-10-18 6:51 ` Thomas Huth
2019-10-18 10:05 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rvjcvzf.fsf@redhat.com \
--to=slp@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.