nfp: add support for NFP3800/NFP3803 PCIe devices
authorDirk van der Merwe <dirk.vandermerwe@netronome.com>
Fri, 11 Mar 2022 10:43:06 +0000 (11:43 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 12 Mar 2022 07:10:22 +0000 (23:10 -0800)
Enable binding the nfp driver to NFP3800 and NFP3803 devices.
The PCIE_SRAM offset is different for the NFP3800 device, which also
only supports a single explicit group.

Changes to Dirk's work:
* 48-bit dma addressing is not ready yet. Keep 40-bit dma addressing
for NFP3800.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_main.c
drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_dev.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_dev.h
include/linux/pci_ids.h

index dd135ac..8693f99 100644 (file)
 static const char nfp_driver_name[] = "nfp";
 
 static const struct pci_device_id nfp_pci_device_ids[] = {
+       { PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP3800,
+         PCI_VENDOR_ID_NETRONOME, PCI_ANY_ID,
+         PCI_ANY_ID, 0, NFP_DEV_NFP3800,
+       },
        { PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP4000,
          PCI_VENDOR_ID_NETRONOME, PCI_ANY_ID,
          PCI_ANY_ID, 0, NFP_DEV_NFP6000,
index db4301f..9ef226c 100644 (file)
@@ -38,6 +38,10 @@ struct nfp_net_vf {
 static const char nfp_net_driver_name[] = "nfp_netvf";
 
 static const struct pci_device_id nfp_netvf_pci_device_ids[] = {
+       { PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP3800_VF,
+         PCI_VENDOR_ID_NETRONOME, PCI_ANY_ID,
+         PCI_ANY_ID, 0, NFP_DEV_NFP3800_VF,
+       },
        { PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP6000_VF,
          PCI_VENDOR_ID_NETRONOME, PCI_ANY_ID,
          PCI_ANY_ID, 0, NFP_DEV_NFP6000_VF,
index 2dd0f58..3d379e9 100644 (file)
 
 #define PCI_64BIT_BAR_COUNT             3
 
-/* NFP hardware vendor/device ids.
- */
-#define PCI_DEVICE_ID_NETRONOME_NFP3800        0x3800
-
 #define NFP_CPP_NUM_TARGETS             16
 /* Max size of area it should be safe to request */
 #define NFP_CPP_SAFE_AREA_SIZE         SZ_2M
index 0c1ef01..28384d6 100644 (file)
@@ -8,6 +8,25 @@
 #include "nfp_dev.h"
 
 const struct nfp_dev_info nfp_dev_info[NFP_DEV_CNT] = {
+       [NFP_DEV_NFP3800] = {
+               .dma_mask               = DMA_BIT_MASK(40),
+               .qc_idx_mask            = GENMASK(8, 0),
+               .qc_addr_offset         = 0x400000,
+               .min_qc_size            = 512,
+               .max_qc_size            = SZ_64K,
+
+               .chip_names             = "NFP3800",
+               .pcie_cfg_expbar_offset = 0x0a00,
+               .pcie_expl_offset       = 0xd000,
+               .qc_area_sz             = 0x100000,
+       },
+       [NFP_DEV_NFP3800_VF] = {
+               .dma_mask               = DMA_BIT_MASK(40),
+               .qc_idx_mask            = GENMASK(8, 0),
+               .qc_addr_offset         = 0,
+               .min_qc_size            = 512,
+               .max_qc_size            = SZ_64K,
+       },
        [NFP_DEV_NFP6000] = {
                .dma_mask               = DMA_BIT_MASK(40),
                .qc_idx_mask            = GENMASK(7, 0),
index deadd9b..d418986 100644 (file)
@@ -7,6 +7,8 @@
 #include <linux/types.h>
 
 enum nfp_dev_id {
+       NFP_DEV_NFP3800,
+       NFP_DEV_NFP3800_VF,
        NFP_DEV_NFP6000,
        NFP_DEV_NFP6000_VF,
        NFP_DEV_CNT,
index c7e6f20..5462c29 100644 (file)
 #define PCI_VENDOR_ID_HUAWEI           0x19e5
 
 #define PCI_VENDOR_ID_NETRONOME                0x19ee
+#define PCI_DEVICE_ID_NETRONOME_NFP3800        0x3800
 #define PCI_DEVICE_ID_NETRONOME_NFP4000        0x4000
 #define PCI_DEVICE_ID_NETRONOME_NFP5000        0x5000
 #define PCI_DEVICE_ID_NETRONOME_NFP6000        0x6000
+#define PCI_DEVICE_ID_NETRONOME_NFP3800_VF     0x3803
 #define PCI_DEVICE_ID_NETRONOME_NFP6000_VF     0x6003
 
 #define PCI_VENDOR_ID_QMI              0x1a32