kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eli Cohen <elic@nvidia.com>
To: Jason Wang <jasowang@redhat.com>
Cc: <mst@redhat.com>, <virtualization@lists.linux-foundation.org>,
	<linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>,
	<netdev@vger.kernel.org>, <eli@mellanox.com>
Subject: Re: [PATCH V2 RESEND 2/4] virtio-pci library: introduce vp_modern_get_driver_features()
Date: Wed, 2 Jun 2021 10:46:06 +0300	[thread overview]
Message-ID: <20210602074606.GF12498@mtl-vdi-166.wap.labs.mlnx> (raw)
In-Reply-To: <20210602021536.39525-3-jasowang@redhat.com>

On Wed, Jun 02, 2021 at 10:15:34AM +0800, Jason Wang wrote:
> This patch introduce a helper to get driver/guest features from the
> device.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Eli Cohen <elic@nvidia.com>
> ---
>  drivers/virtio/virtio_pci_modern_dev.c | 21 +++++++++++++++++++++
>  include/linux/virtio_pci_modern.h      |  1 +
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
> index 54f297028586..e11ed748e661 100644
> --- a/drivers/virtio/virtio_pci_modern_dev.c
> +++ b/drivers/virtio/virtio_pci_modern_dev.c
> @@ -383,6 +383,27 @@ u64 vp_modern_get_features(struct virtio_pci_modern_device *mdev)
>  }
>  EXPORT_SYMBOL_GPL(vp_modern_get_features);
>  
> +/*
> + * vp_modern_get_driver_features - get driver features from device
> + * @mdev: the modern virtio-pci device
> + *
> + * Returns the driver features read from the device
> + */
> +u64 vp_modern_get_driver_features(struct virtio_pci_modern_device *mdev)
> +{
> +	struct virtio_pci_common_cfg __iomem *cfg = mdev->common;
> +
> +	u64 features;
> +
> +	vp_iowrite32(0, &cfg->guest_feature_select);
> +	features = vp_ioread32(&cfg->guest_feature);
> +	vp_iowrite32(1, &cfg->guest_feature_select);
> +	features |= ((u64)vp_ioread32(&cfg->guest_feature) << 32);
> +
> +	return features;
> +}
> +EXPORT_SYMBOL_GPL(vp_modern_get_driver_features);
> +
>  /*
>   * vp_modern_set_features - set features to device
>   * @mdev: the modern virtio-pci device
> diff --git a/include/linux/virtio_pci_modern.h b/include/linux/virtio_pci_modern.h
> index 6a95b58fd0f4..eb2bd9b4077d 100644
> --- a/include/linux/virtio_pci_modern.h
> +++ b/include/linux/virtio_pci_modern.h
> @@ -79,6 +79,7 @@ static inline void vp_iowrite64_twopart(u64 val,
>  }
>  
>  u64 vp_modern_get_features(struct virtio_pci_modern_device *mdev);
> +u64 vp_modern_get_driver_features(struct virtio_pci_modern_device *mdev);
>  void vp_modern_set_features(struct virtio_pci_modern_device *mdev,
>  		     u64 features);
>  u32 vp_modern_generation(struct virtio_pci_modern_device *mdev);
> -- 
> 2.25.1
> 

  reply	other threads:[~2021-06-02  7:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  2:15 [PATCH V2 RESEND 0/4] Packed virtqueue state support for vDPA Jason Wang
2021-06-02  2:15 ` [PATCH V2 RESEND 1/4] vdpa: support packed virtqueue for set/get_vq_state() Jason Wang
2021-06-02  7:44   ` Eli Cohen
2021-06-02  7:45   ` Eli Cohen
2021-06-02  2:15 ` [PATCH V2 RESEND 2/4] virtio-pci library: introduce vp_modern_get_driver_features() Jason Wang
2021-06-02  7:46   ` Eli Cohen [this message]
2021-06-02  2:15 ` [PATCH V2 RESEND 3/4] vp_vdpa: allow set vq state to initial state after reset Jason Wang
2021-06-02  7:46   ` Eli Cohen
2021-06-02  2:15 ` [PATCH V2 RESEND 4/4] virtio/vdpa: clear the virtqueue state during probe Jason Wang
2021-06-02  7:47   ` Eli Cohen

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=20210602074606.GF12498@mtl-vdi-166.wap.labs.mlnx \
    --to=elic@nvidia.com \
    --cc=eli@mellanox.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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).