All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Max Gurtovoy <mgurtovoy@nvidia.com>
Cc: stefanha@redhat.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org
Subject: Re: [PATCH 1/1] virtio_pci: use common helper to configure SR-IOV
Date: Wed, 12 Oct 2022 01:02:27 -0400	[thread overview]
Message-ID: <20221012010143-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220928234008.30302-1-mgurtovoy@nvidia.com>

On Thu, Sep 29, 2022 at 02:40:08AM +0300, Max Gurtovoy wrote:
> This is instead of re-writing the same logic in virtio driver.
> 
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>

Dropped this as it caused build failures:

https://lore.kernel.org/r/202210080424.gSmuYfb0-lkp%40intel.com

> ---
>  drivers/virtio/virtio_pci_common.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index ad258a9d3b9f..67d3970e57f2 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -607,7 +607,6 @@ static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
>  {
>  	struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
>  	struct virtio_device *vdev = &vp_dev->vdev;
> -	int ret;
>  
>  	if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
>  		return -EBUSY;
> @@ -615,19 +614,7 @@ static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
>  	if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
>  		return -EINVAL;
>  
> -	if (pci_vfs_assigned(pci_dev))
> -		return -EPERM;
> -
> -	if (num_vfs == 0) {
> -		pci_disable_sriov(pci_dev);
> -		return 0;
> -	}
> -
> -	ret = pci_enable_sriov(pci_dev, num_vfs);
> -	if (ret < 0)
> -		return ret;
> -
> -	return num_vfs;
> +	return pci_sriov_configure_simple(pci_dev, num_vfs);
>  }
>  
>  static struct pci_driver virtio_pci_driver = {
> -- 
> 2.18.1


WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Max Gurtovoy <mgurtovoy@nvidia.com>
Cc: linux-block@vger.kernel.org, stefanha@redhat.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/1] virtio_pci: use common helper to configure SR-IOV
Date: Wed, 12 Oct 2022 01:02:27 -0400	[thread overview]
Message-ID: <20221012010143-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220928234008.30302-1-mgurtovoy@nvidia.com>

On Thu, Sep 29, 2022 at 02:40:08AM +0300, Max Gurtovoy wrote:
> This is instead of re-writing the same logic in virtio driver.
> 
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>

Dropped this as it caused build failures:

https://lore.kernel.org/r/202210080424.gSmuYfb0-lkp%40intel.com

> ---
>  drivers/virtio/virtio_pci_common.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index ad258a9d3b9f..67d3970e57f2 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -607,7 +607,6 @@ static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
>  {
>  	struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
>  	struct virtio_device *vdev = &vp_dev->vdev;
> -	int ret;
>  
>  	if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
>  		return -EBUSY;
> @@ -615,19 +614,7 @@ static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
>  	if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
>  		return -EINVAL;
>  
> -	if (pci_vfs_assigned(pci_dev))
> -		return -EPERM;
> -
> -	if (num_vfs == 0) {
> -		pci_disable_sriov(pci_dev);
> -		return 0;
> -	}
> -
> -	ret = pci_enable_sriov(pci_dev, num_vfs);
> -	if (ret < 0)
> -		return ret;
> -
> -	return num_vfs;
> +	return pci_sriov_configure_simple(pci_dev, num_vfs);
>  }
>  
>  static struct pci_driver virtio_pci_driver = {
> -- 
> 2.18.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2022-10-12  5:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 23:40 [PATCH 1/1] virtio_pci: use common helper to configure SR-IOV Max Gurtovoy
2022-09-29  6:35 ` Johannes Thumshirn
2022-10-12  2:31 ` Jason Wang
2022-10-12  2:31   ` Jason Wang
2022-10-12  5:02 ` Michael S. Tsirkin [this message]
2022-10-12  5:02   ` Michael S. Tsirkin
2022-10-12  8:42   ` Max Gurtovoy
2022-10-12 10:01     ` Max Gurtovoy
2022-10-12 21:20       ` Bjorn Helgaas
2022-10-12 21:20         ` Bjorn Helgaas via Virtualization
2022-10-12 23:01         ` Max Gurtovoy
2022-10-12 23:19           ` Michael S. Tsirkin
2022-10-12 23:19             ` Michael S. Tsirkin

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=20221012010143-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=stefanha@redhat.com \
    --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 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.