linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Fix ARI enabling for a NVME devices
@ 2019-09-03 12:53 Andrei Leonvikov
  2019-09-03 13:14 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Leonvikov @ 2019-09-03 12:53 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, Andrei Leonchikov

From: Andrei Leonchikov <andreil499@gmail.com>

Signed-off-by: Andrei Leonchikov <andreil499@gmail.com>
---
 drivers/pci/pci.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1b27b5af3..ed5f0888c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3149,9 +3149,12 @@ void pci_configure_ari(struct pci_dev *dev)
 	if (!bridge)
 		return;
 
-	pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap);
-	if (!(cap & PCI_EXP_DEVCAP2_ARI))
-		return;
+	if ((dev->driver != NULL) && (strncmp(dev->driver->name, "nvme", 4) == 0)) {
+		// for NVME device this field always zero, but ARI can be enabled
+		pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap);
+		if (!(cap & PCI_EXP_DEVCAP2_ARI))
+			return;
+	}
 
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI)) {
 		pcie_capability_set_word(bridge, PCI_EXP_DEVCTL2,
-- 
2.21.0


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

* Re: [PATCH 1/1] Fix ARI enabling for a NVME devices
  2019-09-03 12:53 [PATCH 1/1] Fix ARI enabling for a NVME devices Andrei Leonvikov
@ 2019-09-03 13:14 ` Christoph Hellwig
       [not found]   ` <CA+kE0xQ+z4f8xQ=8oRVcTMC-VsU5dyqVUWxuDamTy59_HTYOeg@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2019-09-03 13:14 UTC (permalink / raw)
  To: Andrei Leonvikov; +Cc: bhelgaas, linux-pci, linux-kernel

On Tue, Sep 03, 2019 at 12:53:15PM +0000, Andrei Leonvikov wrote:
> +	if ((dev->driver != NULL) && (strncmp(dev->driver->name, "nvme", 4) == 0)) {
> +		// for NVME device this field always zero, but ARI can be enabled
> +		pcie_capability_read_dword(bridge, PCI_EXP_DEVCAP2, &cap);
> +		if (!(cap & PCI_EXP_DEVCAP2_ARI))
> +			return;
> +	}

Besides the missing patch description, all the obvious style issues, and
the fact that you can't just check a driver name a here:

There are plenty NVMe drives that support the ARI capability, and I
don't know of any standard saying nvme device should be treated special.

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

* Re: [PATCH 1/1] Fix ARI enabling for a NVME devices
       [not found]   ` <CA+kE0xQ+z4f8xQ=8oRVcTMC-VsU5dyqVUWxuDamTy59_HTYOeg@mail.gmail.com>
@ 2019-09-03 16:33     ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-09-03 16:33 UTC (permalink / raw)
  To: Андрей
	Леончиков
  Cc: bhelgaas, linux-pci, linux-kernel, Andrei Leonchikov

[adding back the Cc list]

On Tue, Sep 03, 2019 at 07:24:15PM +0300, Андрей Леончиков wrote:
> All drives has ARI capability, but everywhere the PCI_EXP_DEVCAP2_ARI
> in the DEVCAP2 register is reset (see NVMe specification, bit 5).
> At the same time, when the device is initialized, the DEVSAP register is
> requested and this bit is checked. And if it is reset, ARI will never turn
> on.
> Because of this, it will be impossible to correctly initialize more than 8
> functions per interface (1 physical and 7 virtual).
> At the moment we are developing a disk, one of the requirements for
> which is the correct operation of up to 128 virtual functions on one
> interface.
> During testing of this device, this behavior was noticed.

Looking at the PCIe spec this bit actually means "ARI forwarding
supported" and isn't the actual ARI support.  And the PCIe spec says
about that:

"Applicable only to Switch
Downstream Ports and Root Ports; must be 0b for other
Function types. This bit must be set to 1b if a Switch
Downstream Port or Root Port supports this optional capability.
See Section 6.13 for additional details."

So I don't see how we'd ever see this bit set on an actual NVMe device.

And yes, the name for our define is a little misnamed.

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

end of thread, other threads:[~2019-09-03 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 12:53 [PATCH 1/1] Fix ARI enabling for a NVME devices Andrei Leonvikov
2019-09-03 13:14 ` Christoph Hellwig
     [not found]   ` <CA+kE0xQ+z4f8xQ=8oRVcTMC-VsU5dyqVUWxuDamTy59_HTYOeg@mail.gmail.com>
2019-09-03 16:33     ` Christoph Hellwig

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