linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] liquidio: Use pcie_flr() instead of reimplementing it
@ 2019-08-08  4:57 Denis Efremov
  2019-08-08  9:25 ` Andrew Murray
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Denis Efremov @ 2019-08-08  4:57 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Denis Efremov, Derek Chickles, Satanand Burla, Felix Manlunas,
	netdev, linux-pci, linux-kernel

octeon_mbox_process_cmd() directly writes the PCI_EXP_DEVCTL_BCR_FLR
bit, which bypasses timing requirements imposed by the PCIe spec.
This patch fixes the function to use the pcie_flr() interface instead.

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
index 021d99cd1665..614d07be7181 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
@@ -260,9 +260,7 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,
 		dev_info(&oct->pci_dev->dev,
 			 "got a request for FLR from VF that owns DPI ring %u\n",
 			 mbox->q_no);
-		pcie_capability_set_word(
-			oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no],
-			PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
+		pcie_flr(oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]);
 		break;
 
 	case OCTEON_PF_CHANGED_VF_MACADDR:
-- 
2.21.0


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

* Re: [PATCH] liquidio: Use pcie_flr() instead of reimplementing it
  2019-08-08  4:57 [PATCH] liquidio: Use pcie_flr() instead of reimplementing it Denis Efremov
@ 2019-08-08  9:25 ` Andrew Murray
  2019-08-08 18:48 ` Bjorn Helgaas
  2019-08-09  5:41 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Murray @ 2019-08-08  9:25 UTC (permalink / raw)
  To: Denis Efremov
  Cc: Bjorn Helgaas, Derek Chickles, Satanand Burla, Felix Manlunas,
	netdev, linux-pci, linux-kernel

On Thu, Aug 08, 2019 at 07:57:53AM +0300, Denis Efremov wrote:
> octeon_mbox_process_cmd() directly writes the PCI_EXP_DEVCTL_BCR_FLR
> bit, which bypasses timing requirements imposed by the PCIe spec.
> This patch fixes the function to use the pcie_flr() interface instead.
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
>  drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> index 021d99cd1665..614d07be7181 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> @@ -260,9 +260,7 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,
>  		dev_info(&oct->pci_dev->dev,
>  			 "got a request for FLR from VF that owns DPI ring %u\n",
>  			 mbox->q_no);
> -		pcie_capability_set_word(
> -			oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no],
> -			PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
> +		pcie_flr(oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]);
>  		break;

It's possible for pcie_flr to fail if the device doesn't become ready soon
enough after reset in which case it returns ENOTTY. I think it's OK not to
test the return value here though, as pci_dev_wait will print a warning
anyway, and I'm not sure what you'd do with it anyway.

Reviewed-by: Andrew Murray <andrew.murray@arm.com>

>  
>  	case OCTEON_PF_CHANGED_VF_MACADDR:
> -- 
> 2.21.0
> 

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

* Re: [PATCH] liquidio: Use pcie_flr() instead of reimplementing it
  2019-08-08  4:57 [PATCH] liquidio: Use pcie_flr() instead of reimplementing it Denis Efremov
  2019-08-08  9:25 ` Andrew Murray
@ 2019-08-08 18:48 ` Bjorn Helgaas
  2019-08-09  5:41 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2019-08-08 18:48 UTC (permalink / raw)
  To: Denis Efremov
  Cc: Bjorn Helgaas, Derek Chickles, Satanand Burla, Felix Manlunas,
	netdev, linux-pci, linux-kernel

On Thu, Aug 08, 2019 at 07:57:53AM +0300, Denis Efremov wrote:
> octeon_mbox_process_cmd() directly writes the PCI_EXP_DEVCTL_BCR_FLR
> bit, which bypasses timing requirements imposed by the PCIe spec.
> This patch fixes the function to use the pcie_flr() interface instead.
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>

Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>

Thanks for doing this, Denis.  When possible it's better to use a PCI
core interface than to fiddle with PCI config space directly from a
driver.

> ---
>  drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> index 021d99cd1665..614d07be7181 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> @@ -260,9 +260,7 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,
>  		dev_info(&oct->pci_dev->dev,
>  			 "got a request for FLR from VF that owns DPI ring %u\n",
>  			 mbox->q_no);
> -		pcie_capability_set_word(
> -			oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no],
> -			PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
> +		pcie_flr(oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]);
>  		break;
>  
>  	case OCTEON_PF_CHANGED_VF_MACADDR:
> -- 
> 2.21.0
> 

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

* Re: [PATCH] liquidio: Use pcie_flr() instead of reimplementing it
  2019-08-08  4:57 [PATCH] liquidio: Use pcie_flr() instead of reimplementing it Denis Efremov
  2019-08-08  9:25 ` Andrew Murray
  2019-08-08 18:48 ` Bjorn Helgaas
@ 2019-08-09  5:41 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-08-09  5:41 UTC (permalink / raw)
  To: efremov
  Cc: bjorn.helgaas, dchickles, sburla, fmanlunas, netdev, linux-pci,
	linux-kernel

From: Denis Efremov <efremov@linux.com>
Date: Thu,  8 Aug 2019 07:57:53 +0300

> octeon_mbox_process_cmd() directly writes the PCI_EXP_DEVCTL_BCR_FLR
> bit, which bypasses timing requirements imposed by the PCIe spec.
> This patch fixes the function to use the pcie_flr() interface instead.
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>

Applied to net-next.

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

end of thread, other threads:[~2019-08-09  5:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08  4:57 [PATCH] liquidio: Use pcie_flr() instead of reimplementing it Denis Efremov
2019-08-08  9:25 ` Andrew Murray
2019-08-08 18:48 ` Bjorn Helgaas
2019-08-09  5:41 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).