2014-01-07 21:39:53

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH 0/7] Phase out pci_enable_msi_block()

As result of recent deprecation of MSI-X/MSI enablement
interfaces pci_enable_msi_block(), pci_enable_msi() and
pci_enable_msix() all drivers need to be updated to use
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

This is the first in a series of updates, to phase out
pci_enable_msi_block() function.

This series is against pci/msi branch in Bjorn Helgaas's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git

Thanks!

Alexander Gordeev (7):
ipr: Do not call pci_disable_msi/msix() if pci_enable_msi/msix()
failed
ipr: Use new interfaces for MSI/MSI-X enablement
ahci: Use new interfaces for MSI/MSI-X enablement
nvme: Use new interfaces for MSI/MSI-X enablement
vfio: Use new interfaces for MSI/MSI-X enablement
ath10k: Use new interfaces for MSI enablement
wil6210: Use new interfaces for MSI enablement

drivers/ata/ahci.c | 15 +++-----
drivers/block/nvme-core.c | 33 ++++-------------
drivers/net/wireless/ath/ath10k/pci.c | 22 ++++++------
drivers/net/wireless/ath/wil6210/pcie_bus.c | 36 ++++++++++---------
drivers/scsi/ipr.c | 51 +++++++++-----------------
drivers/vfio/pci/vfio_pci_intrs.c | 8 ++--
6 files changed, 66 insertions(+), 99 deletions(-)

--
1.7.7.6



2014-01-08 12:45:02

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement

Alexander Gordeev <[email protected]> writes:

> On Wed, Jan 08, 2014 at 10:23:18AM +0200, Kalle Valo wrote:
>
>> Do you want me to take this patch to my ath.git tree or how were you
>> planning to handle it?
>
> I see no option other than pushing it thru pci.git tree at this stage.

Thanks, I'll then just drop it from my queue.

--
Kalle Valo

2014-01-07 21:39:26

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement

This update also fixes a stylistic (naming and messaging only)
confusion of MSI-X vs multiple MSIs which are not the same.

Signed-off-by: Alexander Gordeev <[email protected]>
---
drivers/net/wireless/ath/ath10k/pci.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 9e86a81..08807fe 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2073,14 +2073,14 @@ static void ath10k_pci_tasklet(unsigned long data)
}
}

-static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num)
+static int ath10k_pci_start_intr_multi_msi(struct ath10k *ar, int num)
{
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret;
int i;

- ret = pci_enable_msi_block(ar_pci->pdev, num);
- if (ret)
+ ret = pci_enable_msi_range(ar_pci->pdev, num, num);
+ if (ret < 0)
return ret;

ret = request_irq(ar_pci->pdev->irq + MSI_ASSIGN_FW,
@@ -2111,16 +2111,16 @@ static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num)
}
}

- ath10k_info("MSI-X interrupt handling (%d intrs)\n", num);
+ ath10k_info("Multi MSI interrupt handling (%d intrs)\n", num);
return 0;
}

-static int ath10k_pci_start_intr_msi(struct ath10k *ar)
+static int ath10k_pci_start_intr_single_msi(struct ath10k *ar)
{
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret;

- ret = pci_enable_msi(ar_pci->pdev);
+ ret = pci_enable_msi_range(ar_pci->pdev, 1, 1);
if (ret < 0)
return ret;

@@ -2132,7 +2132,7 @@ static int ath10k_pci_start_intr_msi(struct ath10k *ar)
return ret;
}

- ath10k_info("MSI interrupt handling\n");
+ ath10k_info("Single MSI interrupt handling\n");
return 0;
}

@@ -2199,20 +2199,20 @@ static int ath10k_pci_start_intr(struct ath10k *ar)
num = 1;

if (num > 1) {
- ret = ath10k_pci_start_intr_msix(ar, num);
+ ret = ath10k_pci_start_intr_multi_msi(ar, num);
if (ret == 0)
goto exit;

- ath10k_warn("MSI-X didn't succeed (%d), trying MSI\n", ret);
+ ath10k_warn("Multi MSI failed (%d), trying single MSI\n", ret);
num = 1;
}

if (num == 1) {
- ret = ath10k_pci_start_intr_msi(ar);
+ ret = ath10k_pci_start_intr_single_msi(ar);
if (ret == 0)
goto exit;

- ath10k_warn("MSI didn't succeed (%d), trying legacy INTR\n",
+ ath10k_warn("Single MSI failed (%d), trying legacy INTR\n",
ret);
num = 0;
}
--
1.7.7.6


2014-01-08 12:19:05

by Vladimir Kondratiev

[permalink] [raw]
Subject: Re: [PATCH 7/7] wil6210: Use new interfaces for MSI enablement

On Wednesday, January 08, 2014 12:54:01 PM Alexander Gordeev wrote:
> Vladimir,
>
> This series is against pci/msi branch in Bjorn Helgaas's repo:
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
>
> Commit 302a252 "PCI/MSI: Add pci_enable_msi_range() and pci_enable_msix_range()"
>

Thanks, see it. New code don't distinguish between negative and positive error
values, same as old code. I'll fix it.

Meanwhile, below my

Acked-by: Vladimir Kondratiev <[email protected]>

2014-01-08 08:23:25

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement

Alexander Gordeev <[email protected]> writes:

> This update also fixes a stylistic (naming and messaging only)
> confusion of MSI-X vs multiple MSIs which are not the same.
>
> Signed-off-by: Alexander Gordeev <[email protected]>

Looks good to me.

Acked-by: Kalle Valo <[email protected]>

Do you want me to take this patch to my ath.git tree or how were you
planning to handle it?

--
Kalle Valo

2014-01-07 21:39:21

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH 7/7] wil6210: Use new interfaces for MSI enablement

Signed-off-by: Alexander Gordeev <[email protected]>
---
drivers/net/wireless/ath/wil6210/pcie_bus.c | 36 ++++++++++++++------------
1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index eeceab3..022dfe4 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -41,30 +41,32 @@ static int wil_if_pcie_enable(struct wil6210_priv *wil)
switch (use_msi) {
case 3:
case 1:
+ wil_dbg_misc(wil, "Setup %d MSI interrupts\n", use_msi);
+ break;
case 0:
+ wil_dbg_misc(wil, "MSI interrupts disabled, use INTx\n");
break;
default:
- wil_err(wil, "Invalid use_msi=%d, default to 1\n",
- use_msi);
+ wil_err(wil, "Invalid use_msi=%d, default to 1\n", use_msi);
use_msi = 1;
}
- wil->n_msi = use_msi;
- if (wil->n_msi) {
- wil_dbg_misc(wil, "Setup %d MSI interrupts\n", use_msi);
- rc = pci_enable_msi_block(pdev, wil->n_msi);
- if (rc && (wil->n_msi == 3)) {
- wil_err(wil, "3 MSI mode failed, try 1 MSI\n");
- wil->n_msi = 1;
- rc = pci_enable_msi_block(pdev, wil->n_msi);
- }
- if (rc) {
- wil_err(wil, "pci_enable_msi failed, use INTx\n");
- wil->n_msi = 0;
- }
- } else {
- wil_dbg_misc(wil, "MSI interrupts disabled, use INTx\n");
+
+ switch (use_msi) {
+ case 3:
+ if (pci_enable_msi_range(pdev, 3, 3) > 0)
+ break;
+ wil_err(wil, "3 MSI mode failed, try 1 MSI\n");
+ use_msi = 1;
+ /* fallthrough */
+ case 1:
+ if (pci_enable_msi_range(pdev, 1, 1) > 0)
+ break;
+ wil_err(wil, "pci_enable_msi_range failed, use INTx\n");
+ use_msi = 0;
}

+ wil->n_msi = use_msi;
+
rc = wil6210_init_irq(wil, pdev->irq);
if (rc)
goto stop_master;
--
1.7.7.6


2014-01-08 11:30:50

by Vladimir Kondratiev

[permalink] [raw]
Subject: Re: [PATCH 7/7] wil6210: Use new interfaces for MSI enablement

On Tuesday, January 07, 2014 07:05:42 PM Alexander Gordeev wrote:
> Signed-off-by: Alexander Gordeev <[email protected]>
> ---
> drivers/net/wireless/ath/wil6210/pcie_bus.c | 36 ++++++++++++++------------
> 1 files changed, 19 insertions(+), 17 deletions(-)
>

Patch looks fine, but I can't validate it as I can't find patch introducing
pci_enable_msi_range(). Where this patch landed on?

I am working with:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git

I also checked
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
and, of course
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Thanks, Vladimir

2014-01-08 09:03:10

by Alexander Gordeev

[permalink] [raw]
Subject: Re: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement

On Wed, Jan 08, 2014 at 10:23:18AM +0200, Kalle Valo wrote:
> Looks good to me.
>
> Acked-by: Kalle Valo <[email protected]>

Thanks, Kalle.

> Do you want me to take this patch to my ath.git tree or how were you
> planning to handle it?

I see no option other than pushing it thru pci.git tree at this stage.

> --
> Kalle Valo

--
Regards,
Alexander Gordeev
[email protected]

2014-01-08 12:32:26

by Alexander Gordeev

[permalink] [raw]
Subject: Re: [PATCH 7/7] wil6210: Use new interfaces for MSI enablement

On Wed, Jan 08, 2014 at 02:19:01PM +0200, Vladimir Kondratiev wrote:
> Thanks, see it. New code don't distinguish between negative and positive error
> values, same as old code. I'll fix it.

As the patch seems okay for you, I am not quite getting what else needs
to be fixed? :)

> Meanwhile, below my
>
> Acked-by: Vladimir Kondratiev <[email protected]>

Thanks, Vladimir!

--
Regards,
Alexander Gordeev
[email protected]

2014-01-08 11:52:00

by Alexander Gordeev

[permalink] [raw]
Subject: Re: [PATCH 7/7] wil6210: Use new interfaces for MSI enablement

On Wed, Jan 08, 2014 at 01:30:45PM +0200, Vladimir Kondratiev wrote:
> On Tuesday, January 07, 2014 07:05:42 PM Alexander Gordeev wrote:
> > Signed-off-by: Alexander Gordeev <[email protected]>
> > ---
> > drivers/net/wireless/ath/wil6210/pcie_bus.c | 36 ++++++++++++++------------
> > 1 files changed, 19 insertions(+), 17 deletions(-)
> >
>
> Patch looks fine, but I can't validate it as I can't find patch introducing
> pci_enable_msi_range(). Where this patch landed on?

Vladimir,

This series is against pci/msi branch in Bjorn Helgaas's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git

Commit 302a252 "PCI/MSI: Add pci_enable_msi_range() and pci_enable_msix_range()"

> I am working with:
> git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
>
> I also checked
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> and, of course
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
> Thanks, Vladimir

--
Regards,
Alexander Gordeev
[email protected]