Re: [PATCH 1/1] virtio_pci: use common helper to configure SR-IOV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 10/12/2022 8:02 AM, Michael S. Tsirkin wrote:
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@xxxxxxxxxx>
Dropped this as it caused build failures:

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

maybe you can re-run it with:

diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile
index 8e98d24917cc..b383326a20e2 100644
--- a/drivers/virtio/Makefile
+++ b/drivers/virtio/Makefile
@@ -5,10 +5,11 @@ obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio_pci_modern_dev.o
 obj-$(CONFIG_VIRTIO_PCI_LIB_LEGACY) += virtio_pci_legacy_dev.o
 obj-$(CONFIG_VIRTIO_MMIO) += virtio_mmio.o
 obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o
-virtio_pci-y := virtio_pci_modern.o virtio_pci_common.o
-virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o
 obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o
 obj-$(CONFIG_VIRTIO_INPUT) += virtio_input.o
 obj-$(CONFIG_VIRTIO_VDPA) += virtio_vdpa.o
 obj-$(CONFIG_VIRTIO_MEM) += virtio_mem.o
 obj-$(CONFIG_VIRTIO_DMA_SHARED_BUFFER) += virtio_dma_buf.o
+
+virtio_pci-$(CONFIG_VIRTIO_PCI) := virtio_pci_modern.o virtio_pci_common.o
+virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o



---
  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



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux