qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: qemu-devel@nongnu.org, Zhu Lingshan <lingshan.zhu@intel.com>,
	 Harpreet Singh Anand <hanand@xilinx.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	 Si-Wei Liu <si-wei.liu@oracle.com>,
	"Michael S. Tsirkin" <mst@redhat.com>, Cindy Lu <lulu@redhat.com>,
	 Laurent Vivier <lvivier@redhat.com>,
	Eli Cohen <eli@mellanox.com>,
	 Liuxiangdong <liuxiangdong5@huawei.com>,
	Parav Pandit <parav@mellanox.com>,
	 Gautam Dawar <gdawar@xilinx.com>
Subject: Re: [RFC PATCH v2 2/8] vdpa: Save emulated features list in vhost_vdpa
Date: Thu, 20 Oct 2022 12:22:50 +0800	[thread overview]
Message-ID: <CACGkMEvQOksFuE37SCCW+4x=Ku5CfHpcbgCDq6tic_H5fW7hYw@mail.gmail.com> (raw)
In-Reply-To: <20221019125210.226291-3-eperezma@redhat.com>

On Wed, Oct 19, 2022 at 8:52 PM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> At this moment only _F_LOG is added there.
>
> However future patches add features that depend on the kind of device.
> In particular, only net devices can add VIRTIO_F_GUEST_ANNOUNCE. So
> let's allow vhost_vdpa creator to set custom emulated device features.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>  include/hw/virtio/vhost-vdpa.h | 2 ++
>  hw/virtio/vhost-vdpa.c         | 8 ++++----
>  net/vhost-vdpa.c               | 4 ++++
>  3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
> index 1111d85643..50083e1e3b 100644
> --- a/include/hw/virtio/vhost-vdpa.h
> +++ b/include/hw/virtio/vhost-vdpa.h
> @@ -31,6 +31,8 @@ typedef struct vhost_vdpa {
>      bool iotlb_batch_begin_sent;
>      MemoryListener listener;
>      struct vhost_vdpa_iova_range iova_range;
> +    /* VirtIO device features that can be emulated by qemu */
> +    uint64_t added_features;

Any reason we need a per vhost_vdpa storage for this? Or is there a
chance that this field could be different among the devices?

Thanks

>      uint64_t acked_features;
>      bool shadow_vqs_enabled;
>      /* IOVA mapping used by the Shadow Virtqueue */
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 7468e44b87..ddb5e29288 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -660,8 +660,8 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
>
>          v->acked_features = features;
>
> -        /* We must not ack _F_LOG if SVQ is enabled */
> -        features &= ~BIT_ULL(VHOST_F_LOG_ALL);
> +        /* Do not ack features emulated by qemu */
> +        features &= ~v->added_features;
>      }
>
>      trace_vhost_vdpa_set_features(dev, features);
> @@ -1244,8 +1244,8 @@ static int vhost_vdpa_get_features(struct vhost_dev *dev,
>      int ret = vhost_vdpa_get_dev_features(dev, features);
>
>      if (ret == 0 && v->shadow_vqs_enabled) {
> -        /* Add SVQ logging capabilities */
> -        *features |= BIT_ULL(VHOST_F_LOG_ALL);
> +        /* Add emulated capabilities */
> +        *features |= v->added_features;
>      }
>
>      return ret;
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index eebf29f5c1..3803452800 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -599,6 +599,10 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
>      s->vhost_vdpa.index = queue_pair_index;
>      s->vhost_vdpa.shadow_vqs_enabled = svq;
>      s->vhost_vdpa.iova_tree = iova_tree;
> +    if (svq) {
> +        /* Add SVQ logging capabilities */
> +        s->vhost_vdpa.added_features |= BIT_ULL(VHOST_F_LOG_ALL);
> +    }
>      if (!is_datapath) {
>          s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(),
>                                              vhost_vdpa_net_cvq_cmd_page_len());
> --
> 2.31.1
>



  reply	other threads:[~2022-10-20  4:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 12:52 [RFC PATCH v2 0/8] Guest announce feature emulation using Shadow VirtQueue Eugenio Pérez
2022-10-19 12:52 ` [RFC PATCH v2 1/8] vdpa: Delete duplicated vdpa_feature_bits entry Eugenio Pérez
2022-10-20  4:12   ` Jason Wang
2022-10-19 12:52 ` [RFC PATCH v2 2/8] vdpa: Save emulated features list in vhost_vdpa Eugenio Pérez
2022-10-20  4:22   ` Jason Wang [this message]
2022-10-20  6:34     ` Eugenio Perez Martin
2022-10-21  2:57       ` Jason Wang
2022-10-21  8:56         ` Eugenio Perez Martin
2022-10-24  2:14           ` Jason Wang
2022-10-24  9:25             ` Eugenio Perez Martin
2022-10-25  2:45               ` Jason Wang
2022-10-25  6:54                 ` Eugenio Perez Martin
2022-10-19 12:52 ` [RFC PATCH v2 3/8] vhost_net: Emulate link state up if backend doesn't expose it Eugenio Pérez
2022-10-20  4:29   ` Jason Wang
2022-10-20  6:35     ` Eugenio Perez Martin
2022-10-19 12:52 ` [RFC PATCH v2 4/8] vdpa: Expose VIRTIO_NET_F_STATUS unconditionally Eugenio Pérez
2022-10-19 12:52 ` [RFC PATCH v2 5/8] vdpa: Remove shadow CVQ command check Eugenio Pérez
2022-10-20  4:31   ` Jason Wang
2022-10-19 12:52 ` [RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Eugenio Pérez
2022-10-20  4:35   ` Jason Wang
2022-10-20  7:00     ` Eugenio Perez Martin
2022-10-21  3:01       ` Jason Wang
2022-10-21  9:05         ` Eugenio Perez Martin
2022-10-24  2:15           ` Jason Wang
2022-10-19 12:52 ` [RFC PATCH v2 7/8] vhost_net: return VIRTIO_NET_S_ANNOUNCE is device model has it set Eugenio Pérez
2022-10-20  4:35   ` Jason Wang
2022-10-19 12:52 ` [RFC PATCH v2 8/8] vdpa: Offer VIRTIO_NET_F_GUEST_ANNOUNCE feature if SVQ is enabled Eugenio Pérez
2022-10-20  4:24 ` [RFC PATCH v2 0/8] Guest announce feature emulation using Shadow VirtQueue Jason Wang
2022-10-20  8:38   ` Eugenio Perez Martin

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='CACGkMEvQOksFuE37SCCW+4x=Ku5CfHpcbgCDq6tic_H5fW7hYw@mail.gmail.com' \
    --to=jasowang@redhat.com \
    --cc=eli@mellanox.com \
    --cc=eperezma@redhat.com \
    --cc=gdawar@xilinx.com \
    --cc=hanand@xilinx.com \
    --cc=lingshan.zhu@intel.com \
    --cc=liuxiangdong5@huawei.com \
    --cc=lulu@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.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).