Skip to contentSkip to conversation

Support Netronome NFP6000 family quirks

PATCH New Simon Horman 1 participant 4 messages Sep 15, 2015 PCI

lore
Share & tools
lore
#0 lore raw

cover Support Netronome NFP6000 family quirks

Hi,

this short patch-set adds support for Netronome NFP6000 family quirks.

Base:

This patchset is based on the next branch of Bjorn Helgaas's PCI tree.

About NFP6000 Drivers (someone is bound to ask):

My understanding is that Netronome is actively working on preparing to submit NFP6000 family drivers to mainline. For now they can be found on github at https://github.com/Netronome/nfp-drv-kmods

Jason S. McMullan (3):
PCI: Support PCIe devices with short cfg_size
PCI: Add Netronome vendor and device IDs
PCI: Support Netronome NFP6000 family quirks

 drivers/pci/pci-sysfs.c | 18 +++++++++---------
 drivers/pci/quirks.c    | 11 +++++++++++
 include/linux/pci_ids.h |  6 ++++++
 3 files changed, 26 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/3 PCI: Support PCIe devices with short cfg_size

From: "Jason S. McMullan" <[email protected]>

If a PCIe device has a 'quirk' where the quirk modifies the pci_dev->cfg_size to be less than PCI_CFG_SPACE_EXP_SIZE, but greater than PCI_CFG_SPACE_SIZE then the pci sysfs interface truncates the readable size to PCI_CFG_SPACE_SIZE.

This patch corrects this issue.

This is in preparation for adding a quirk for such a case.

[simon: edited changelog]
---
 drivers/pci/pci-sysfs.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/pci/pci-sysfs.c +9 -9
index 312f23a8429c..cf8eba5d8e14 100644
@@ -1369,10 +1369,10 @@ int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
 	if (!sysfs_initialized)
 		return -EACCES;
 
-	if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
-		retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr);
-	else
+	if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
 		retval = sysfs_create_bin_file(&pdev->dev.kobj, &pcie_config_attr);
+	else
+		retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr);
 	if (retval)
 		goto err;
 
@@ -1424,10 +1424,10 @@ err_rom_file:
 err_resource_files:
 	pci_remove_resource_files(pdev);
 err_config_file:
-	if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
-		sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
-	else
+	if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
 		sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr);
+	else
+		sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
 err:
 	return retval;
 }
@@ -1461,10 +1461,10 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
 
 	pci_remove_capabilities_sysfs(pdev);
 
-	if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE)
-		sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
-	else
+	if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
 		sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr);
+	else
+		sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
 
 	pci_remove_resource_files(pdev);
 
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/3 PCI: Add Netronome vendor and device IDs

In reply to Simon Horman

From: "Jason S. McMullan" <[email protected]>

Device IDs for the Netronome NFP3200, NFP3240, NFP6000, and NFP6000 SR-IOV devices.

[simon: edited changelog]
---
 include/linux/pci_ids.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/pci_ids.h +6 -0
index fcff8f865341..085abd9681af 100644
@@ -2486,6 +2486,12 @@
 #define PCI_DEVICE_ID_KORENIX_JETCARDF2	0x1700
 #define PCI_DEVICE_ID_KORENIX_JETCARDF3	0x17ff
 
+#define PCI_VENDOR_ID_NETRONOME		0x19ee
+#define PCI_DEVICE_ID_NETRONOME_NFP3200	0x3200
+#define PCI_DEVICE_ID_NETRONOME_NFP3240	0x3240
+#define PCI_DEVICE_ID_NETRONOME_NFP6000	0x6000
+#define PCI_DEVICE_ID_NETRONOME_NFP6000_VF	0x6003
+
 #define PCI_VENDOR_ID_QMI		0x1a32
 
 #define PCI_VENDOR_ID_AZWAVE		0x1a3b
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/3 PCI: Support Netronome NFP6000 family quirks

In reply to Simon Horman

From: "Jason S. McMullan" <[email protected]>

The NFP6000 has an errata where reading/writing to PCI config space addresses above 0x600 can cause the NFP to generate PCIe completion timeouts.

This patch addresses this issue, by limiting the NFP6000's config space size to 0x600 bytes.

[simon: edited changelog]
---
 drivers/pci/quirks.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/pci/quirks.c +11 -0
index de5f610e0810..adcdee3e562f 100644
@@ -287,6 +287,17 @@ static void quirk_citrine(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CITRINE,	quirk_citrine);
 
+/*
+ *  This chip can cause bus lockups if config addresses above 0x600
+ *  are read or written to.
+ */
+static void quirk_nfp6000(struct pci_dev *dev)
+{
+	dev->cfg_size = 0x600;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME,	PCI_DEVICE_ID_NETRONOME_NFP6000,	quirk_nfp6000);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME,	PCI_DEVICE_ID_NETRONOME_NFP6000_VF,	quirk_nfp6000);
+
 /*  On IBM Crocodile ipr SAS adapters, expand BAR to system page size */
 static void quirk_extend_bar_to_page(struct pci_dev *dev)
 {
Signature · 1 line
2.1.4