All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix()
@ 2014-02-19  8:58 Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 1/9] cciss: Fallback to MSI rather than to INTx if MSI-X failed Alexander Gordeev
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alexander Gordeev, Jens Axboe, Mike Miller, Asai Thambi S P,
	Joshua Morris, Philip Kelleher, Kyungmin Park, iss_storagedev,
	linux-pci

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() and pci_enable_msix_range()
interfaces.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Joshua Morris <josh.h.morris@us.ibm.com>
Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: iss_storagedev@hp.com
Cc: linux-pci@vger.kernel.org

Alexander Gordeev (9):
  cciss: Fallback to MSI rather than to INTx if MSI-X failed
  cciss: Use pci_enable_msix_range() instead of pci_enable_msix()
  mtip32xx: Remove superfluous call to pci_disable_msi()
  mtip32xx: Use pci_enable_msix_range() instead of pci_enable_msix()
  rsxx: Use pci_enable_msix_range() instead of pci_enable_msix()
  skd: Fix out of array boundary access
  skd: Fix incomplete cleanup of MSI-X interrupt
  skd: Use unified access to skdev->msix_entries throughout the code
  skd: Use pci_enable_msix_range() instead of pci_enable_msix()

 drivers/block/cciss.c             |   14 +++-----
 drivers/block/mtip32xx/mtip32xx.c |    8 +++--
 drivers/block/rsxx/core.c         |    4 +-
 drivers/block/skd_main.c          |   67 +++++++++++++++----------------------
 4 files changed, 39 insertions(+), 54 deletions(-)

-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/9] cciss: Fallback to MSI rather than to INTx if MSI-X failed
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 2/9] cciss: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Gordeev, Mike Miller, iss_storagedev, linux-pci

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: iss_storagedev@hp.com
Cc: linux-pci@vger.kernel.org
---
 drivers/block/cciss.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 036e8ab..fc5b0a4 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4092,13 +4092,14 @@ static void cciss_interrupt_mode(ctlr_info_t *h)
 		if (err > 0) {
 			dev_warn(&h->pdev->dev,
 				"only %d MSI-X vectors available\n", err);
-			goto default_int_mode;
+			goto single_msi_mode;
 		} else {
 			dev_warn(&h->pdev->dev,
 				"MSI-X init failed %d\n", err);
-			goto default_int_mode;
+			goto single_msi_mode;
 		}
 	}
+single_msi_mode:
 	if (pci_find_capability(h->pdev, PCI_CAP_ID_MSI)) {
 		if (!pci_enable_msi(h->pdev))
 			h->msi_vector = 1;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/9] cciss: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 1/9] cciss: Fallback to MSI rather than to INTx if MSI-X failed Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 3/9] mtip32xx: Remove superfluous call to pci_disable_msi() Alexander Gordeev
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Gordeev, Mike Miller, iss_storagedev, linux-pci

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() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: iss_storagedev@hp.com
Cc: linux-pci@vger.kernel.org
---
 drivers/block/cciss.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index fc5b0a4..5463cb5 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4080,19 +4080,14 @@ static void cciss_interrupt_mode(ctlr_info_t *h)
 		goto default_int_mode;
 
 	if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
-		err = pci_enable_msix(h->pdev, cciss_msix_entries, 4);
-		if (!err) {
+		err = pci_enable_msix_range(h->pdev, cciss_msix_entries, 4, 4);
+		if (err > 0) {
 			h->intr[0] = cciss_msix_entries[0].vector;
 			h->intr[1] = cciss_msix_entries[1].vector;
 			h->intr[2] = cciss_msix_entries[2].vector;
 			h->intr[3] = cciss_msix_entries[3].vector;
 			h->msix_vector = 1;
 			return;
-		}
-		if (err > 0) {
-			dev_warn(&h->pdev->dev,
-				"only %d MSI-X vectors available\n", err);
-			goto single_msi_mode;
 		} else {
 			dev_warn(&h->pdev->dev,
 				"MSI-X init failed %d\n", err);
@@ -4101,7 +4096,7 @@ static void cciss_interrupt_mode(ctlr_info_t *h)
 	}
 single_msi_mode:
 	if (pci_find_capability(h->pdev, PCI_CAP_ID_MSI)) {
-		if (!pci_enable_msi(h->pdev))
+		if (pci_enable_msi_range(h->pdev, 1, 1) > 0)
 			h->msi_vector = 1;
 		else
 			dev_warn(&h->pdev->dev, "MSI init failed\n");
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/9] mtip32xx: Remove superfluous call to pci_disable_msi()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 1/9] cciss: Fallback to MSI rather than to INTx if MSI-X failed Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 2/9] cciss: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 4/9] mtip32xx: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Gordeev, Jens Axboe, Asai Thambi S P, linux-pci

There is no need to call pci_disable_msi() in case
the previous call to pci_enable_msi() failed

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/mtip32xx/mtip32xx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 5160269..5299a65 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4615,7 +4615,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 	if (rv) {
 		dev_warn(&pdev->dev,
 			"Unable to enable MSI interrupt.\n");
-		goto block_initialize_err;
+		goto msi_initialize_err;
 	}
 
 	/* Initialize the block layer. */
@@ -4645,6 +4645,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 
 block_initialize_err:
 	pci_disable_msi(pdev);
+
+msi_initialize_err:
 	if (dd->isr_workq) {
 		flush_workqueue(dd->isr_workq);
 		destroy_workqueue(dd->isr_workq);
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/9] mtip32xx: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (2 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 3/9] mtip32xx: Remove superfluous call to pci_disable_msi() Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 5/9] rsxx: " Alexander Gordeev
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Gordeev, Jens Axboe, Asai Thambi S P, linux-pci

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() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/mtip32xx/mtip32xx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 5299a65..60e86e8 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4611,8 +4611,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 	INIT_WORK(&dd->work[7].work, mtip_workq_sdbf7);
 
 	pci_set_master(pdev);
-	rv = pci_enable_msi(pdev);
-	if (rv) {
+	rv = pci_enable_msi_range(pdev, 1, 1);
+	if (rv < 0) {
 		dev_warn(&pdev->dev,
 			"Unable to enable MSI interrupt.\n");
 		goto msi_initialize_err;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/9] rsxx: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (3 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 4/9] mtip32xx: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 6/9] skd: Fix out of array boundary access Alexander Gordeev
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Gordeev, Joshua Morris, Philip Kelleher, linux-pci

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() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Joshua Morris <josh.h.morris@us.ibm.com>
Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/rsxx/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index a8de2ee..76c8124 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -880,8 +880,8 @@ static int rsxx_pci_probe(struct pci_dev *dev,
 	spin_unlock_irq(&card->irq_lock);
 
 	if (!force_legacy) {
-		st = pci_enable_msi(dev);
-		if (st)
+		st = pci_enable_msi_range(dev, 1, 1);
+		if (st < 0)
 			dev_warn(CARD_TO_DEV(card),
 				"Failed to enable MSI\n");
 	}
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/9] skd: Fix out of array boundary access
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (4 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 5/9] rsxx: " Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 7/9] skd: Fix incomplete cleanup of MSI-X interrupt Alexander Gordeev
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alexander Gordeev, Jens Axboe, Bartlomiej Zolnierkiewicz,
	Kyungmin Park, linux-pci

When enabling MSI-X, interrupts are requested for SKD_MAX_MSIX_COUNT
entries in skdev->msix_entries array, while the number of actually
allocated entries is skdev->msix_count. This might lead to an out of
boundary access in case number of allocated entries is less than
SKD_MAX_MSIX_COUNT. This update fixes the described misbehaviour.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/skd_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index eb6e1e0..3fa0918 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3989,7 +3989,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
 	}
 
 	/* Enable MSI-X vectors for the base queue */
-	for (i = 0; i < SKD_MAX_MSIX_COUNT; i++) {
+	for (i = 0; i < skdev->msix_count; i++) {
 		qentry = &skdev->msix_entries[i];
 		snprintf(qentry->isr_name, sizeof(qentry->isr_name),
 			 "%s%d-msix %s", DRV_NAME, skdev->devno,
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/9] skd: Fix incomplete cleanup of MSI-X interrupt
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (5 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 6/9] skd: Fix out of array boundary access Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 8/9] skd: Use unified access to skdev->msix_entries throughout the code Alexander Gordeev
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alexander Gordeev, Jens Axboe, Bartlomiej Zolnierkiewicz,
	Kyungmin Park, linux-pci

When enabling MSI-X interrupts fails due to lack of memory
the call to pci_disable_msix() is missed and the device is
left with MSI-X interrupts enabled while the driver assumes
otherwise. This update fixes the described misbehaviour and
cleans up the code of skd_release_msix() function.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/skd_main.c |   50 +++++++++++++++++++++++----------------------
 1 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 3fa0918..d0550ba 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3910,43 +3910,44 @@ static void skd_release_msix(struct skd_device *skdev)
 	struct skd_msix_entry *qentry;
 	int i;
 
-	if (skdev->msix_entries == NULL)
-		return;
-	for (i = 0; i < skdev->msix_count; i++) {
-		qentry = &skdev->msix_entries[i];
-		skdev = qentry->rsp;
+	if (skdev->msix_entries) {
+		for (i = 0; i < skdev->msix_count; i++) {
+			qentry = &skdev->msix_entries[i];
+			skdev = qentry->rsp;
+
+			if (qentry->have_irq)
+				devm_free_irq(&skdev->pdev->dev,
+					      qentry->vector, qentry->rsp);
+		}
 
-		if (qentry->have_irq)
-			devm_free_irq(&skdev->pdev->dev,
-				      qentry->vector, qentry->rsp);
+		kfree(skdev->msix_entries);
 	}
-	pci_disable_msix(skdev->pdev);
-	kfree(skdev->msix_entries);
+
+	if (skdev->msix_count)
+		pci_disable_msix(skdev->pdev);
+
 	skdev->msix_count = 0;
 	skdev->msix_entries = NULL;
 }
 
 static int skd_acquire_msix(struct skd_device *skdev)
 {
-	int i, rc;
-	struct pci_dev *pdev;
-	struct msix_entry *entries = NULL;
+	int i, rc, msix_count = SKD_MAX_MSIX_COUNT;
+	struct pci_dev *pdev = skdev->pdev;
+	struct msix_entry *entries;
 	struct skd_msix_entry *qentry;
 
-	pdev = skdev->pdev;
-	skdev->msix_count = SKD_MAX_MSIX_COUNT;
-	entries = kzalloc(sizeof(struct msix_entry) * SKD_MAX_MSIX_COUNT,
-			  GFP_KERNEL);
+	entries = kzalloc(sizeof(struct msix_entry) * msix_count, GFP_KERNEL);
 	if (!entries)
 		return -ENOMEM;
 
-	for (i = 0; i < SKD_MAX_MSIX_COUNT; i++)
+	for (i = 0; i < msix_count; i++)
 		entries[i].entry = i;
 
-	rc = pci_enable_msix(pdev, entries, SKD_MAX_MSIX_COUNT);
+	rc = pci_enable_msix(pdev, entries, msix_count);
 	if (rc < 0)
 		goto msix_out;
-	if (rc) {
+	else if (rc) {
 		if (rc < SKD_MIN_MSIX_COUNT) {
 			pr_err("(%s): failed to enable MSI-X %d\n",
 			       skd_name(skdev), rc);
@@ -3956,20 +3957,21 @@ static int skd_acquire_msix(struct skd_device *skdev)
 			 skdev->name, __func__, __LINE__,
 			 pci_name(pdev), skdev->name, rc);
 
-		skdev->msix_count = rc;
-		rc = pci_enable_msix(pdev, entries, skdev->msix_count);
+		msix_count = rc;
+		rc = pci_enable_msix(pdev, entries, msix_count);
 		if (rc) {
 			pr_err("(%s): failed to enable MSI-X "
 			       "support (%d) %d\n",
-			       skd_name(skdev), skdev->msix_count, rc);
+			       skd_name(skdev), msix_count, rc);
 			goto msix_out;
 		}
 	}
+
+	skdev->msix_count = msix_count;
 	skdev->msix_entries = kzalloc(sizeof(struct skd_msix_entry) *
 				      skdev->msix_count, GFP_KERNEL);
 	if (!skdev->msix_entries) {
 		rc = -ENOMEM;
-		skdev->msix_count = 0;
 		pr_err("(%s): msix table allocation error\n",
 		       skd_name(skdev));
 		goto msix_out;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 8/9] skd: Use unified access to skdev->msix_entries throughout the code
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (6 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 7/9] skd: Fix incomplete cleanup of MSI-X interrupt Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-19  8:58 ` [PATCH 9/9] skd: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alexander Gordeev, Jens Axboe, Bartlomiej Zolnierkiewicz,
	Kyungmin Park, linux-pci

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/skd_main.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index d0550ba..1cd1095 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3977,8 +3977,8 @@ static int skd_acquire_msix(struct skd_device *skdev)
 		goto msix_out;
 	}
 
-	qentry = skdev->msix_entries;
 	for (i = 0; i < skdev->msix_count; i++) {
+		qentry = &skdev->msix_entries[i];
 		qentry->vector = entries[i].vector;
 		qentry->entry = entries[i].entry;
 		qentry->rsp = NULL;
@@ -3987,7 +3987,6 @@ static int skd_acquire_msix(struct skd_device *skdev)
 			 skdev->name, __func__, __LINE__,
 			 pci_name(pdev), skdev->name,
 			 i, qentry->vector, qentry->entry);
-		qentry++;
 	}
 
 	/* Enable MSI-X vectors for the base queue */
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 9/9] skd: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (7 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 8/9] skd: Use unified access to skdev->msix_entries throughout the code Alexander Gordeev
@ 2014-02-19  8:58 ` Alexander Gordeev
  2014-02-21 23:46 ` [PATCH 0/9] block: " Jens Axboe
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-19  8:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Alexander Gordeev, Jens Axboe, Bartlomiej Zolnierkiewicz,
	Kyungmin Park, linux-pci

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() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/skd_main.c |   38 ++++++++++++--------------------------
 1 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 1cd1095..a69dd93 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3932,42 +3932,28 @@ static void skd_release_msix(struct skd_device *skdev)
 
 static int skd_acquire_msix(struct skd_device *skdev)
 {
-	int i, rc, msix_count = SKD_MAX_MSIX_COUNT;
+	int i, rc;
 	struct pci_dev *pdev = skdev->pdev;
 	struct msix_entry *entries;
 	struct skd_msix_entry *qentry;
 
-	entries = kzalloc(sizeof(struct msix_entry) * msix_count, GFP_KERNEL);
+	entries = kzalloc(sizeof(struct msix_entry) * SKD_MAX_MSIX_COUNT,
+			  GFP_KERNEL);
 	if (!entries)
 		return -ENOMEM;
 
-	for (i = 0; i < msix_count; i++)
+	for (i = 0; i < SKD_MAX_MSIX_COUNT; i++)
 		entries[i].entry = i;
 
-	rc = pci_enable_msix(pdev, entries, msix_count);
-	if (rc < 0)
+	rc = pci_enable_msix_range(pdev, entries,
+				   SKD_MIN_MSIX_COUNT, SKD_MAX_MSIX_COUNT);
+	if (rc < 0) {
+		pr_err("(%s): failed to enable MSI-X %d\n",
+		       skd_name(skdev), rc);
 		goto msix_out;
-	else if (rc) {
-		if (rc < SKD_MIN_MSIX_COUNT) {
-			pr_err("(%s): failed to enable MSI-X %d\n",
-			       skd_name(skdev), rc);
-			goto msix_out;
-		}
-		pr_debug("%s:%s:%d %s: <%s> allocated %d MSI-X vectors\n",
-			 skdev->name, __func__, __LINE__,
-			 pci_name(pdev), skdev->name, rc);
-
-		msix_count = rc;
-		rc = pci_enable_msix(pdev, entries, msix_count);
-		if (rc) {
-			pr_err("(%s): failed to enable MSI-X "
-			       "support (%d) %d\n",
-			       skd_name(skdev), msix_count, rc);
-			goto msix_out;
-		}
 	}
 
-	skdev->msix_count = msix_count;
+	skdev->msix_count = rc;
 	skdev->msix_entries = kzalloc(sizeof(struct skd_msix_entry) *
 				      skdev->msix_count, GFP_KERNEL);
 	if (!skdev->msix_entries) {
@@ -4046,8 +4032,8 @@ RETRY_IRQ_TYPE:
 	case SKD_IRQ_MSI:
 		snprintf(skdev->isr_name, sizeof(skdev->isr_name), "%s%d-msi",
 			 DRV_NAME, skdev->devno);
-		rc = pci_enable_msi(pdev);
-		if (!rc) {
+		rc = pci_enable_msi_range(pdev, 1, 1);
+		if (rc > 0) {
 			rc = devm_request_irq(&pdev->dev, pdev->irq, skd_isr, 0,
 					      skdev->isr_name, skdev);
 			if (rc) {
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (8 preceding siblings ...)
  2014-02-19  8:58 ` [PATCH 9/9] skd: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
@ 2014-02-21 23:46 ` Jens Axboe
  2014-02-22  9:38   ` Alexander Gordeev
  2014-02-25 21:31 ` [PATCH 10/9] skd: Use pci_enable_msix_exact() instead of pci_enable_msix_range() Alexander Gordeev
  2014-02-25 21:33 ` [PATCH 11/9] mtip32xx: Use pci_enable_msi() instead of pci_enable_msi_range() Alexander Gordeev
  11 siblings, 1 reply; 16+ messages in thread
From: Jens Axboe @ 2014-02-21 23:46 UTC (permalink / raw)
  To: Alexander Gordeev
  Cc: linux-kernel, Mike Miller, Asai Thambi S P, Joshua Morris,
	Philip Kelleher, Kyungmin Park, iss_storagedev, linux-pci

On Wed, Feb 19 2014, Alexander Gordeev wrote:
> 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() and pci_enable_msix_range()
> interfaces.

Thanks. Applied 3-4, and 6-9 (didn't get the others).

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-21 23:46 ` [PATCH 0/9] block: " Jens Axboe
@ 2014-02-22  9:38   ` Alexander Gordeev
  2014-02-24 17:16     ` Jens Axboe
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-22  9:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-kernel, Mike Miller, Asai Thambi S P, Joshua Morris,
	Philip Kelleher, Kyungmin Park, iss_storagedev, linux-pci

On Fri, Feb 21, 2014 at 03:46:13PM -0800, Jens Axboe wrote:
> On Wed, Feb 19 2014, Alexander Gordeev wrote:
> > 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() and pci_enable_msix_range()
> > interfaces.
> 
> Thanks. Applied 3-4, and 6-9 (didn't get the others).

Oh, I just realized I posted outdated series, sorry for that :(
Out of applied patch 4 is not needed and patch 9 needs a rework.

Should I repost the whole series?

> -- 
> Jens Axboe

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix()
  2014-02-22  9:38   ` Alexander Gordeev
@ 2014-02-24 17:16     ` Jens Axboe
  0 siblings, 0 replies; 16+ messages in thread
From: Jens Axboe @ 2014-02-24 17:16 UTC (permalink / raw)
  To: Alexander Gordeev
  Cc: linux-kernel, Mike Miller, Asai Thambi S P, Joshua Morris,
	Philip Kelleher, Kyungmin Park, iss_storagedev, linux-pci

On 2014-02-22 01:38, Alexander Gordeev wrote:
> On Fri, Feb 21, 2014 at 03:46:13PM -0800, Jens Axboe wrote:
>> On Wed, Feb 19 2014, Alexander Gordeev wrote:
>>> 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() and pci_enable_msix_range()
>>> interfaces.
>>
>> Thanks. Applied 3-4, and 6-9 (didn't get the others).
>
> Oh, I just realized I posted outdated series, sorry for that :(
> Out of applied patch 4 is not needed and patch 9 needs a rework.
>
> Should I repost the whole series?

Send a revised series against the previous, since they are already 
committed.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 10/9] skd: Use pci_enable_msix_exact() instead of pci_enable_msix_range()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (9 preceding siblings ...)
  2014-02-21 23:46 ` [PATCH 0/9] block: " Jens Axboe
@ 2014-02-25 21:31 ` Alexander Gordeev
  2014-02-25 22:19   ` Jens Axboe
  2014-02-25 21:33 ` [PATCH 11/9] mtip32xx: Use pci_enable_msi() instead of pci_enable_msi_range() Alexander Gordeev
  11 siblings, 1 reply; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-25 21:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jens Axboe, Bartlomiej Zolnierkiewicz, Kyungmin Park, linux-pci

Function pci_enable_msix_exact() is a variation of
pci_enable_msix_range() that allows a device driver
to request a particular number of MSI-X interrupts,
rather than any number within a specified range.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/skd_main.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index a69dd93..c244c5bc 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3945,15 +3945,14 @@ static int skd_acquire_msix(struct skd_device *skdev)
 	for (i = 0; i < SKD_MAX_MSIX_COUNT; i++)
 		entries[i].entry = i;
 
-	rc = pci_enable_msix_range(pdev, entries,
-				   SKD_MIN_MSIX_COUNT, SKD_MAX_MSIX_COUNT);
-	if (rc < 0) {
+	rc = pci_enable_msix_exact(pdev, entries, SKD_MAX_MSIX_COUNT);
+	if (rc) {
 		pr_err("(%s): failed to enable MSI-X %d\n",
 		       skd_name(skdev), rc);
 		goto msix_out;
 	}
 
-	skdev->msix_count = rc;
+	skdev->msix_count = SKD_MAX_MSIX_COUNT;
 	skdev->msix_entries = kzalloc(sizeof(struct skd_msix_entry) *
 				      skdev->msix_count, GFP_KERNEL);
 	if (!skdev->msix_entries) {
-- 
1.7.7.6

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/9] mtip32xx: Use pci_enable_msi() instead of pci_enable_msi_range()
  2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
                   ` (10 preceding siblings ...)
  2014-02-25 21:31 ` [PATCH 10/9] skd: Use pci_enable_msix_exact() instead of pci_enable_msix_range() Alexander Gordeev
@ 2014-02-25 21:33 ` Alexander Gordeev
  11 siblings, 0 replies; 16+ messages in thread
From: Alexander Gordeev @ 2014-02-25 21:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, Asai Thambi S P, linux-pci

Commit "mtip32xx: Use pci_enable_msix_range() instead of
pci_enable_msix()" was unnecessary, since pci_enable_msi()
function is not deprecated and is still preferable for
enabling the single MSI mode. This update reverts usage of
pci_enable_msi() function.

Besides, the changelog for that commit was bogus, since
mtip32xx driver uses MSI interrupt, not MSI-X.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/block/mtip32xx/mtip32xx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 60e86e8..5299a65 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4611,8 +4611,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 	INIT_WORK(&dd->work[7].work, mtip_workq_sdbf7);
 
 	pci_set_master(pdev);
-	rv = pci_enable_msi_range(pdev, 1, 1);
-	if (rv < 0) {
+	rv = pci_enable_msi(pdev);
+	if (rv) {
 		dev_warn(&pdev->dev,
 			"Unable to enable MSI interrupt.\n");
 		goto msi_initialize_err;
-- 
1.7.7.6

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 10/9] skd: Use pci_enable_msix_exact() instead of pci_enable_msix_range()
  2014-02-25 21:31 ` [PATCH 10/9] skd: Use pci_enable_msix_exact() instead of pci_enable_msix_range() Alexander Gordeev
@ 2014-02-25 22:19   ` Jens Axboe
  0 siblings, 0 replies; 16+ messages in thread
From: Jens Axboe @ 2014-02-25 22:19 UTC (permalink / raw)
  To: Alexander Gordeev
  Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Kyungmin Park,
	linux-pci, Asai Thambi S P

On Tue, Feb 25 2014, Alexander Gordeev wrote:
> Function pci_enable_msix_exact() is a variation of
> pci_enable_msix_range() that allows a device driver
> to request a particular number of MSI-X interrupts,
> rather than any number within a specified range.

Applied 10-11, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-02-25 22:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-19  8:58 [PATCH 0/9] block: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
2014-02-19  8:58 ` [PATCH 1/9] cciss: Fallback to MSI rather than to INTx if MSI-X failed Alexander Gordeev
2014-02-19  8:58 ` [PATCH 2/9] cciss: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
2014-02-19  8:58 ` [PATCH 3/9] mtip32xx: Remove superfluous call to pci_disable_msi() Alexander Gordeev
2014-02-19  8:58 ` [PATCH 4/9] mtip32xx: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
2014-02-19  8:58 ` [PATCH 5/9] rsxx: " Alexander Gordeev
2014-02-19  8:58 ` [PATCH 6/9] skd: Fix out of array boundary access Alexander Gordeev
2014-02-19  8:58 ` [PATCH 7/9] skd: Fix incomplete cleanup of MSI-X interrupt Alexander Gordeev
2014-02-19  8:58 ` [PATCH 8/9] skd: Use unified access to skdev->msix_entries throughout the code Alexander Gordeev
2014-02-19  8:58 ` [PATCH 9/9] skd: Use pci_enable_msix_range() instead of pci_enable_msix() Alexander Gordeev
2014-02-21 23:46 ` [PATCH 0/9] block: " Jens Axboe
2014-02-22  9:38   ` Alexander Gordeev
2014-02-24 17:16     ` Jens Axboe
2014-02-25 21:31 ` [PATCH 10/9] skd: Use pci_enable_msix_exact() instead of pci_enable_msix_range() Alexander Gordeev
2014-02-25 22:19   ` Jens Axboe
2014-02-25 21:33 ` [PATCH 11/9] mtip32xx: Use pci_enable_msi() instead of pci_enable_msi_range() Alexander Gordeev

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.