Skip to contentSkip to conversation

virtio: Use pci_enable_msix_range() instead of pci_enable_msix()

PATCH In review Alexander Gordeev 3 participants 9 messages Feb 19, 2014 – Feb 24, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: Use pci_enable_msix_range() instead of pci_enable_msix()

As result deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces.

---
 drivers/virtio/virtio_pci.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/virtio/virtio_pci.c +3 -5
index a416f9b..dea042c 100644
@@ -333,11 +333,9 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 	for (i = 0; i < nvectors; ++i)
 		vp_dev->msix_entries[i].entry = i;
 
-	/* pci_enable_msix returns positive if we can't get this many. */
-	err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
-	if (err > 0)
-		err = -ENOSPC;
-	if (err)
+	err = pci_enable_msix_range(vp_dev->pci_dev,
+				    vp_dev->msix_entries, nvectors, nvectors);
+	if (err < 0)
 		goto error;
 	vp_dev->msix_enabled = 1;
 
Signature · 1 line
1.7.7.6
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · Alexander Gordeev

As result deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces.

---
 drivers/virtio/virtio_pci.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/virtio/virtio_pci.c +0 -0
index a416f9b..dea042c 100644
@@ -333,11 +333,9 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 	for (i = 0; i < nvectors; ++i)
 		vp_dev->msix_entries[i].entry = i;
 

drivers/virtio/virtio_pci.c static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, · line 340

Quoted 10 lines
drivers/virtio/virtio_pci.c +3 -5
-	/* pci_enable_msix returns positive if we can't get this many. */
-	err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
-	if (err > 0)
-		err = -ENOSPC;
-	if (err)
+	err = pci_enable_msix_range(vp_dev->pci_dev,
+				    vp_dev->msix_entries, nvectors, nvectors);
+	if (err < 0)
 		goto error;
 	vp_dev->msix_enabled = 1;

I've put this in my pending queue, but in case someone else wants to take it:

Cheers,
Rusty.

Acked-by on v1 1/1
#2 lore raw
In reply to Alexander Gordeev
Quoted 24 lines · Alexander Gordeev

As result deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces.

---
 drivers/virtio/virtio_pci.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/virtio/virtio_pci.c +0 -0
index a416f9b..dea042c 100644
@@ -333,11 +333,9 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 	for (i = 0; i < nvectors; ++i)
 		vp_dev->msix_entries[i].entry = i;
 

drivers/virtio/virtio_pci.c static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, · line 340

Quoted 10 lines
drivers/virtio/virtio_pci.c +3 -5
-	/* pci_enable_msix returns positive if we can't get this many. */
-	err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
-	if (err > 0)
-		err = -ENOSPC;
-	if (err)
+	err = pci_enable_msix_range(vp_dev->pci_dev,
+				    vp_dev->msix_entries, nvectors, nvectors);
+	if (err < 0)
 		goto error;
 	vp_dev->msix_enabled = 1;

I've put this in my pending queue, but in case someone else wants to take it:

Cheers,
Rusty.

#3 lore raw

Hi Rusty et al,

Based on recently accepted to the mainline pci_enable_msix_exact() function, I am sending a updated version of the patch. Please, let me know if it does not work for you and you need and incremental update from the previous version.

Thanks!

Signature · 3 lines
Regards,
Alexander Gordeev
[email protected]
#4 lore raw

PATCH v2 1/1 virtio: Use pci_enable_msix_exact() instead of pci_enable_msix()

As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces.

---
 drivers/virtio/virtio_pci.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/virtio/virtio_pci.c +2 -4
index a416f9b..101db3f 100644
@@ -333,10 +333,8 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 	for (i = 0; i < nvectors; ++i)
 		vp_dev->msix_entries[i].entry = i;
 
-	/* pci_enable_msix returns positive if we can't get this many. */
-	err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
-	if (err > 0)
-		err = -ENOSPC;
+	err = pci_enable_msix_exact(vp_dev->pci_dev,
+				    vp_dev->msix_entries, nvectors);
 	if (err)
 		goto error;
 	vp_dev->msix_enabled = 1;
Signature · 6 lines
1.7.7.6

-- 
Regards,
Alexander Gordeev
[email protected]
maintainer Acked-by on v2 1/1
#5 lore raw

Re: [PATCH v2] virtio: Use pci_enable_msix_exact() instead of pci_enable_msix()

Quoted 6 lines · Alexander Gordeev

As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces.

Quoted 34 lines
---
 drivers/virtio/virtio_pci.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/virtio/virtio_pci.c +2 -4
index a416f9b..101db3f 100644
@@ -333,10 +333,8 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 	for (i = 0; i < nvectors; ++i)
 		vp_dev->msix_entries[i].entry = i;
 
-	/* pci_enable_msix returns positive if we can't get this many. */
-	err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
-	if (err > 0)
-		err = -ENOSPC;
+	err = pci_enable_msix_exact(vp_dev->pci_dev,
+				    vp_dev->msix_entries, nvectors);
 	if (err)
 		goto error;
 	vp_dev->msix_enabled = 1;
Signature · 6 lines
1.7.7.6

-- 
Regards,
Alexander Gordeev
[email protected]
#6 lore raw

Re: [PATCH v2] virtio: Use pci_enable_msix_exact() instead of pci_enable_msix()

Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Alexander Gordeev

As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces.

Thanks, applied.

Cheers,
Rusty.

#7 lore raw

Re: [PATCH v2] virtio: Use pci_enable_msix_exact() instead of pci_enable_msix()

In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Alexander Gordeev

As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces.

Thanks, applied.

Cheers,
Rusty.

maintainer Acked-by on v1 1/1
#8 lore raw
In reply to Alexander Gordeev
Quoted 6 lines · Alexander Gordeev

As result deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces.

Quoted 6 lines
Quoted 25 lines
---
 drivers/virtio/virtio_pci.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/virtio/virtio_pci.c +3 -5
index a416f9b..dea042c 100644
@@ -333,11 +333,9 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
 	for (i = 0; i < nvectors; ++i)
 		vp_dev->msix_entries[i].entry = i;
 
-	/* pci_enable_msix returns positive if we can't get this many. */
-	err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
-	if (err > 0)
-		err = -ENOSPC;
-	if (err)
+	err = pci_enable_msix_range(vp_dev->pci_dev,
+				    vp_dev->msix_entries, nvectors, nvectors);
+	if (err < 0)
 		goto error;
 	vp_dev->msix_enabled = 1;
 
Signature · 1 line
1.7.7.6