From: Jason Wang <jasowang@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>, qemu-devel@nongnu.org
Cc: Parav Pandit <parav@mellanox.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
virtualization@lists.linux-foundation.org,
Harpreet Singh Anand <hanand@xilinx.com>,
Xiao W Wang <xiao.w.wang@intel.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Eli Cohen <eli@mellanox.com>, Eric Blake <eblake@redhat.com>,
Michael Lilja <ml@napatech.com>
Subject: Re: [RFC PATCH v4 13/20] vdpa: Save host and guest features
Date: Wed, 13 Oct 2021 11:56:59 +0800 [thread overview]
Message-ID: <37bddd4a-eeae-33c3-45f5-3d9070a25513@redhat.com> (raw)
In-Reply-To: <20211001070603.307037-14-eperezma@redhat.com>
在 2021/10/1 下午3:05, Eugenio Pérez 写道:
> Those are needed for SVQ: Host ones are needed to check if SVQ knows
> how to talk with the device and for feature negotiation, and guest ones
> to know if SVQ can talk with it.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> include/hw/virtio/vhost-vdpa.h | 2 ++
> hw/virtio/vhost-vdpa.c | 31 ++++++++++++++++++++++++++++---
> 2 files changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
> index fddac248b3..9044ae694b 100644
> --- a/include/hw/virtio/vhost-vdpa.h
> +++ b/include/hw/virtio/vhost-vdpa.h
> @@ -26,6 +26,8 @@ typedef struct vhost_vdpa {
> int device_fd;
> uint32_t msg_type;
> MemoryListener listener;
> + uint64_t host_features;
> + uint64_t guest_features;
Any reason that we can't use the features stored in VirtioDevice?
Thanks
> bool shadow_vqs_enabled;
> GPtrArray *shadow_vqs;
> struct vhost_dev *dev;
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 6c5f4c98b8..a057e8277d 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -439,10 +439,19 @@ static int vhost_vdpa_set_mem_table(struct vhost_dev *dev,
> return 0;
> }
>
> -static int vhost_vdpa_set_features(struct vhost_dev *dev,
> - uint64_t features)
> +/**
> + * Internal set_features() that follows vhost/VirtIO protocol for that
> + */
> +static int vhost_vdpa_backend_set_features(struct vhost_dev *dev,
> + uint64_t features)
> {
> + struct vhost_vdpa *v = dev->opaque;
> +
> int ret;
> + if (v->host_features & BIT_ULL(VIRTIO_F_QUEUE_STATE)) {
> + features |= BIT_ULL(VIRTIO_F_QUEUE_STATE);
> + }
> +
> trace_vhost_vdpa_set_features(dev, features);
> ret = vhost_vdpa_call(dev, VHOST_SET_FEATURES, &features);
> uint8_t status = 0;
> @@ -455,6 +464,17 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
> return !(status & VIRTIO_CONFIG_S_FEATURES_OK);
> }
>
> +/**
> + * Exposed vhost set features
> + */
> +static int vhost_vdpa_set_features(struct vhost_dev *dev,
> + uint64_t features)
> +{
> + struct vhost_vdpa *v = dev->opaque;
> + v->guest_features = features;
> + return vhost_vdpa_backend_set_features(dev, features);
> +}
> +
> static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev)
> {
> uint64_t features;
> @@ -673,12 +693,17 @@ static int vhost_vdpa_set_vring_call(struct vhost_dev *dev,
> }
>
> static int vhost_vdpa_get_features(struct vhost_dev *dev,
> - uint64_t *features)
> + uint64_t *features)
> {
> int ret;
>
> ret = vhost_vdpa_call(dev, VHOST_GET_FEATURES, features);
> trace_vhost_vdpa_get_features(dev, *features);
> +
> + if (ret == 0) {
> + struct vhost_vdpa *v = dev->opaque;
> + v->host_features = *features;
> + }
> return ret;
> }
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-10-13 3:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211001070603.307037-1-eperezma@redhat.com>
2021-10-12 3:59 ` [RFC PATCH v4 00/20] vDPA shadow virtqueue Jason Wang
2021-10-12 4:06 ` Jason Wang
[not found] ` <20211001070603.307037-9-eperezma@redhat.com>
2021-10-13 3:27 ` [RFC PATCH v4 08/20] vhost: Route guest->host notification through " Jason Wang
[not found] ` <CAJaqyWd2joWx3kKz=cJBs4UxZofP7ETkbpg9+cSQSE2MSyBtUg@mail.gmail.com>
2021-10-15 3:45 ` Jason Wang
[not found] ` <20211001070603.307037-10-eperezma@redhat.com>
2021-10-13 3:43 ` [RFC PATCH v4 09/20] vdpa: Save call_fd in vhost-vdpa Jason Wang
[not found] ` <20211001070603.307037-11-eperezma@redhat.com>
2021-10-13 3:43 ` [RFC PATCH v4 10/20] vhost-vdpa: Take into account SVQ in vhost_vdpa_set_vring_call Jason Wang
[not found] ` <20211001070603.307037-12-eperezma@redhat.com>
2021-10-13 3:47 ` [RFC PATCH v4 11/20] vhost: Route host->guest notification through shadow virtqueue Jason Wang
[not found] ` <CAJaqyWfm734HrwTJK71hUQNYVkyDaR8OiqtGro_AX9i_pXfmBQ@mail.gmail.com>
2021-10-15 4:42 ` Jason Wang
[not found] ` <CAJaqyWcO9oaGsRe-oMNbmHx7G4Mw0vZfc+7WYQ23+SteoFVn4Q@mail.gmail.com>
2021-10-20 2:01 ` Jason Wang
2021-10-13 3:49 ` Jason Wang
[not found] ` <CAJaqyWcQ314RN7-U1bYqCMXb+-nyhSi3ddqWv90ofFucMbveUw@mail.gmail.com>
2021-10-15 4:24 ` Jason Wang
[not found] ` <20211001070603.307037-13-eperezma@redhat.com>
2021-10-13 3:54 ` [RFC PATCH v4 12/20] virtio: Add vhost_shadow_vq_get_vring_addr Jason Wang
[not found] ` <20211001070603.307037-14-eperezma@redhat.com>
2021-10-13 3:56 ` Jason Wang [this message]
[not found] ` <20211001070603.307037-16-eperezma@redhat.com>
2021-10-13 4:31 ` [RFC PATCH v4 15/20] vhost: Shadow virtqueue buffers forwarding Jason Wang
[not found] ` <CAJaqyWeaJyxh-tt45wxONzuOLhVt6wO48e2ufZZ3uECHTDofFw@mail.gmail.com>
2021-10-15 4:23 ` Jason Wang
[not found] ` <20211001070603.307037-17-eperezma@redhat.com>
2021-10-13 4:35 ` [RFC PATCH v4 16/20] vhost: Check for device VRING_USED_F_NO_NOTIFY at shadow virtqueue kick Jason Wang
[not found] ` <20211001070603.307037-18-eperezma@redhat.com>
2021-10-13 4:36 ` [RFC PATCH v4 17/20] vhost: Use VRING_AVAIL_F_NO_INTERRUPT at device call on shadow virtqueue Jason Wang
[not found] ` <20211001070603.307037-21-eperezma@redhat.com>
2021-10-13 5:34 ` [RFC PATCH v4 20/20] vdpa: Add custom IOTLB translations to SVQ Jason Wang
[not found] ` <CAJaqyWdEGWFNrxqKxRya=ybRiP0wTZ0aPksBBeOe9KOjOmUnqA@mail.gmail.com>
2021-10-15 7:37 ` Jason Wang
[not found] ` <CAJaqyWf7pFiw2twq9BPyr9fOJFa9ZpSMcbnoknOfC_pbuUWkmg@mail.gmail.com>
2021-10-15 8:37 ` Jason Wang
2021-10-19 9:24 ` Jason Wang
[not found] ` <CAJaqyWcRcm9rwuTqJHS0FmuMrXpoCvF34TzXKQmxXTfZssZ-jA@mail.gmail.com>
2021-10-20 2:02 ` Jason Wang
2021-10-20 2:07 ` Jason Wang
[not found] ` <CAJaqyWe6R_32Se75XF3+NUZyiWr+cLYQ_86LExmom-vCRT9G0g@mail.gmail.com>
2021-10-20 9:03 ` Jason Wang
[not found] ` <CAJaqyWd9LjpA5w2f1s+pNmdNjYPvcbJgPqY+Qv1fWb+6LPPzAg@mail.gmail.com>
2021-10-21 2:38 ` Jason Wang
2021-10-26 4:32 ` Jason Wang
[not found] ` <20211001070603.307037-19-eperezma@redhat.com>
2021-10-19 8:32 ` [RFC PATCH v4 18/20] vhost: Add VhostIOVATree Jason Wang
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=37bddd4a-eeae-33c3-45f5-3d9070a25513@redhat.com \
--to=jasowang@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=eli@mellanox.com \
--cc=eperezma@redhat.com \
--cc=hanand@xilinx.com \
--cc=ml@napatech.com \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xiao.w.wang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).