diff mbox series

[for-next,v4,12/12] RDMA/erdma: Add driver to kernel build environment

Message ID 20220314064739.81647-13-chengyou@linux.alibaba.com (mailing list archive)
State Superseded
Headers show
Series Elastic RDMA Adapter (ERDMA) driver | expand

Commit Message

Cheng Xu March 14, 2022, 6:47 a.m. UTC
Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
---
 MAINTAINERS                          |  8 ++++++++
 drivers/infiniband/Kconfig           |  1 +
 drivers/infiniband/hw/Makefile       |  1 +
 drivers/infiniband/hw/erdma/Kconfig  | 10 ++++++++++
 drivers/infiniband/hw/erdma/Makefile |  4 ++++
 5 files changed, 24 insertions(+)
 create mode 100644 drivers/infiniband/hw/erdma/Kconfig
 create mode 100644 drivers/infiniband/hw/erdma/Makefile

Comments

kernel test robot March 17, 2022, 3:14 a.m. UTC | #1
Hi Cheng,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on linus/master v5.17-rc8 next-20220316]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Cheng-Xu/Elastic-RDMA-Adapter-ERDMA-driver/20220314-144952
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20220317/202203171051.nVmoVnU3-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ad7293bc27eaf3a5e28fffcc325fb9814e6a170c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Cheng-Xu/Elastic-RDMA-Adapter-ERDMA-driver/20220314-144952
        git checkout ad7293bc27eaf3a5e28fffcc325fb9814e6a170c
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=um SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/infiniband/hw/erdma/erdma_main.c: In function 'erdma_probe_dev':
>> drivers/infiniband/hw/erdma/erdma_main.c:266:34: error: 'struct device' has no member named 'numa_node'
     266 |  dev->attrs.numa_node = pdev->dev.numa_node;
         |                                  ^


vim +266 drivers/infiniband/hw/erdma/erdma_main.c

766cdafe9cd7d4 Cheng Xu 2022-03-14  241  
766cdafe9cd7d4 Cheng Xu 2022-03-14  242  static int erdma_probe_dev(struct pci_dev *pdev)
766cdafe9cd7d4 Cheng Xu 2022-03-14  243  {
766cdafe9cd7d4 Cheng Xu 2022-03-14  244  	int err;
766cdafe9cd7d4 Cheng Xu 2022-03-14  245  	struct erdma_dev *dev;
766cdafe9cd7d4 Cheng Xu 2022-03-14  246  	u32 version;
766cdafe9cd7d4 Cheng Xu 2022-03-14  247  	int bars;
766cdafe9cd7d4 Cheng Xu 2022-03-14  248  
766cdafe9cd7d4 Cheng Xu 2022-03-14  249  	err = pci_enable_device(pdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  250  	if (err) {
766cdafe9cd7d4 Cheng Xu 2022-03-14  251  		dev_err(&pdev->dev, "pci_enable_device failed(%d)\n", err);
766cdafe9cd7d4 Cheng Xu 2022-03-14  252  		return err;
766cdafe9cd7d4 Cheng Xu 2022-03-14  253  	}
766cdafe9cd7d4 Cheng Xu 2022-03-14  254  
766cdafe9cd7d4 Cheng Xu 2022-03-14  255  	pci_set_master(pdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  256  
766cdafe9cd7d4 Cheng Xu 2022-03-14  257  	dev = ib_alloc_device(erdma_dev, ibdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  258  	if (!dev) {
766cdafe9cd7d4 Cheng Xu 2022-03-14  259  		dev_err(&pdev->dev, "ib_alloc_device failed\n");
766cdafe9cd7d4 Cheng Xu 2022-03-14  260  		err = -ENOMEM;
766cdafe9cd7d4 Cheng Xu 2022-03-14  261  		goto err_disable_device;
766cdafe9cd7d4 Cheng Xu 2022-03-14  262  	}
766cdafe9cd7d4 Cheng Xu 2022-03-14  263  
766cdafe9cd7d4 Cheng Xu 2022-03-14  264  	pci_set_drvdata(pdev, dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  265  	dev->pdev = pdev;
766cdafe9cd7d4 Cheng Xu 2022-03-14 @266  	dev->attrs.numa_node = pdev->dev.numa_node;
766cdafe9cd7d4 Cheng Xu 2022-03-14  267  
766cdafe9cd7d4 Cheng Xu 2022-03-14  268  	bars = pci_select_bars(pdev, IORESOURCE_MEM);
766cdafe9cd7d4 Cheng Xu 2022-03-14  269  	err = pci_request_selected_regions(pdev, bars, DRV_MODULE_NAME);
766cdafe9cd7d4 Cheng Xu 2022-03-14  270  	if (bars != ERDMA_BAR_MASK || err) {
766cdafe9cd7d4 Cheng Xu 2022-03-14  271  		err = err == 0 ? -EINVAL : err;
766cdafe9cd7d4 Cheng Xu 2022-03-14  272  		goto err_ib_device_release;
766cdafe9cd7d4 Cheng Xu 2022-03-14  273  	}
766cdafe9cd7d4 Cheng Xu 2022-03-14  274  
766cdafe9cd7d4 Cheng Xu 2022-03-14  275  	dev->func_bar_addr = pci_resource_start(pdev, ERDMA_FUNC_BAR);
766cdafe9cd7d4 Cheng Xu 2022-03-14  276  	dev->func_bar_len = pci_resource_len(pdev, ERDMA_FUNC_BAR);
766cdafe9cd7d4 Cheng Xu 2022-03-14  277  
766cdafe9cd7d4 Cheng Xu 2022-03-14  278  	dev->func_bar = devm_ioremap(&pdev->dev,
766cdafe9cd7d4 Cheng Xu 2022-03-14  279  				     dev->func_bar_addr,
766cdafe9cd7d4 Cheng Xu 2022-03-14  280  				     dev->func_bar_len);
766cdafe9cd7d4 Cheng Xu 2022-03-14  281  	if (!dev->func_bar) {
766cdafe9cd7d4 Cheng Xu 2022-03-14  282  		dev_err(&pdev->dev, "devm_ioremap failed.\n");
766cdafe9cd7d4 Cheng Xu 2022-03-14  283  		err = -EFAULT;
766cdafe9cd7d4 Cheng Xu 2022-03-14  284  		goto err_release_bars;
766cdafe9cd7d4 Cheng Xu 2022-03-14  285  	}
766cdafe9cd7d4 Cheng Xu 2022-03-14  286  
766cdafe9cd7d4 Cheng Xu 2022-03-14  287  	version = erdma_reg_read32(dev, ERDMA_REGS_VERSION_REG);
766cdafe9cd7d4 Cheng Xu 2022-03-14  288  	if (version == 0) {
766cdafe9cd7d4 Cheng Xu 2022-03-14  289  		/* we knows that it is a non-functional function. */
766cdafe9cd7d4 Cheng Xu 2022-03-14  290  		err = -ENODEV;
766cdafe9cd7d4 Cheng Xu 2022-03-14  291  		goto err_iounmap_func_bar;
766cdafe9cd7d4 Cheng Xu 2022-03-14  292  	}
766cdafe9cd7d4 Cheng Xu 2022-03-14  293  
766cdafe9cd7d4 Cheng Xu 2022-03-14  294  	err = erdma_device_init(dev, pdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  295  	if (err)
766cdafe9cd7d4 Cheng Xu 2022-03-14  296  		goto err_iounmap_func_bar;
766cdafe9cd7d4 Cheng Xu 2022-03-14  297  
766cdafe9cd7d4 Cheng Xu 2022-03-14  298  	err = erdma_request_vectors(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  299  	if (err)
766cdafe9cd7d4 Cheng Xu 2022-03-14  300  		goto err_iounmap_func_bar;
766cdafe9cd7d4 Cheng Xu 2022-03-14  301  
766cdafe9cd7d4 Cheng Xu 2022-03-14  302  	err = erdma_comm_irq_init(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  303  	if (err)
766cdafe9cd7d4 Cheng Xu 2022-03-14  304  		goto err_free_vectors;
766cdafe9cd7d4 Cheng Xu 2022-03-14  305  
766cdafe9cd7d4 Cheng Xu 2022-03-14  306  	err = erdma_aeq_init(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  307  	if (err)
766cdafe9cd7d4 Cheng Xu 2022-03-14  308  		goto err_uninit_comm_irq;
766cdafe9cd7d4 Cheng Xu 2022-03-14  309  
766cdafe9cd7d4 Cheng Xu 2022-03-14  310  	err = erdma_cmdq_init(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  311  	if (err)
766cdafe9cd7d4 Cheng Xu 2022-03-14  312  		goto err_uninit_aeq;
766cdafe9cd7d4 Cheng Xu 2022-03-14  313  
766cdafe9cd7d4 Cheng Xu 2022-03-14  314  	err = erdma_ceqs_init(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  315  	if (err)
766cdafe9cd7d4 Cheng Xu 2022-03-14  316  		goto err_uninit_cmdq;
766cdafe9cd7d4 Cheng Xu 2022-03-14  317  
766cdafe9cd7d4 Cheng Xu 2022-03-14  318  	erdma_finish_cmdq_init(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  319  
766cdafe9cd7d4 Cheng Xu 2022-03-14  320  	return 0;
766cdafe9cd7d4 Cheng Xu 2022-03-14  321  
766cdafe9cd7d4 Cheng Xu 2022-03-14  322  err_uninit_cmdq:
766cdafe9cd7d4 Cheng Xu 2022-03-14  323  	erdma_device_uninit(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  324  	erdma_cmdq_destroy(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  325  
766cdafe9cd7d4 Cheng Xu 2022-03-14  326  err_uninit_aeq:
766cdafe9cd7d4 Cheng Xu 2022-03-14  327  	erdma_aeq_destroy(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  328  
766cdafe9cd7d4 Cheng Xu 2022-03-14  329  err_uninit_comm_irq:
766cdafe9cd7d4 Cheng Xu 2022-03-14  330  	erdma_comm_irq_uninit(dev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  331  
766cdafe9cd7d4 Cheng Xu 2022-03-14  332  err_free_vectors:
766cdafe9cd7d4 Cheng Xu 2022-03-14  333  	pci_free_irq_vectors(dev->pdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  334  
766cdafe9cd7d4 Cheng Xu 2022-03-14  335  err_iounmap_func_bar:
766cdafe9cd7d4 Cheng Xu 2022-03-14  336  	devm_iounmap(&pdev->dev, dev->func_bar);
766cdafe9cd7d4 Cheng Xu 2022-03-14  337  
766cdafe9cd7d4 Cheng Xu 2022-03-14  338  err_release_bars:
766cdafe9cd7d4 Cheng Xu 2022-03-14  339  	pci_release_selected_regions(pdev, bars);
766cdafe9cd7d4 Cheng Xu 2022-03-14  340  
766cdafe9cd7d4 Cheng Xu 2022-03-14  341  err_ib_device_release:
766cdafe9cd7d4 Cheng Xu 2022-03-14  342  	ib_dealloc_device(&dev->ibdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  343  
766cdafe9cd7d4 Cheng Xu 2022-03-14  344  err_disable_device:
766cdafe9cd7d4 Cheng Xu 2022-03-14  345  	pci_disable_device(pdev);
766cdafe9cd7d4 Cheng Xu 2022-03-14  346  
766cdafe9cd7d4 Cheng Xu 2022-03-14  347  	return err;
766cdafe9cd7d4 Cheng Xu 2022-03-14  348  }
766cdafe9cd7d4 Cheng Xu 2022-03-14  349  

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index ea3e6c914384..6beb3019764d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -723,6 +723,14 @@  S:	Maintained
 F:	Documentation/i2c/busses/i2c-ali1563.rst
 F:	drivers/i2c/busses/i2c-ali1563.c
 
+ALIBABA ELASTIC RDMA DRIVER
+M:	Cheng Xu <chengyou@linux.alibaba.com>
+M:	Kai Shen <kaishen@linux.alibaba.com>
+L:	linux-rdma@vger.kernel.org
+S:	Supported
+F:	drivers/infiniband/hw/erdma
+F:	include/uapi/rdma/erdma-abi.h
+
 ALIENWARE WMI DRIVER
 L:	Dell.Client.Kernel@dell.com
 S:	Maintained
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index 33d3ce9c888e..cc6a7ff88ff3 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -92,6 +92,7 @@  source "drivers/infiniband/hw/hns/Kconfig"
 source "drivers/infiniband/hw/bnxt_re/Kconfig"
 source "drivers/infiniband/hw/hfi1/Kconfig"
 source "drivers/infiniband/hw/qedr/Kconfig"
+source "drivers/infiniband/hw/erdma/Kconfig"
 source "drivers/infiniband/sw/rdmavt/Kconfig"
 source "drivers/infiniband/sw/rxe/Kconfig"
 source "drivers/infiniband/sw/siw/Kconfig"
diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile
index fba0b3be903e..6b3a88046125 100644
--- a/drivers/infiniband/hw/Makefile
+++ b/drivers/infiniband/hw/Makefile
@@ -13,3 +13,4 @@  obj-$(CONFIG_INFINIBAND_HFI1)		+= hfi1/
 obj-$(CONFIG_INFINIBAND_HNS)		+= hns/
 obj-$(CONFIG_INFINIBAND_QEDR)		+= qedr/
 obj-$(CONFIG_INFINIBAND_BNXT_RE)	+= bnxt_re/
+obj-$(CONFIG_INFINIBAND_ERDMA)		+= erdma/
diff --git a/drivers/infiniband/hw/erdma/Kconfig b/drivers/infiniband/hw/erdma/Kconfig
new file mode 100644
index 000000000000..8526689fede7
--- /dev/null
+++ b/drivers/infiniband/hw/erdma/Kconfig
@@ -0,0 +1,10 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+config INFINIBAND_ERDMA
+	tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
+	depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
+	depends on INFINIBAND_ADDR_TRANS
+	depends on INFINIBAND_USER_ACCESS
+	help
+	  This is a RDMA/iWarp driver for Alibaba Elastic RDMA Adapter(ERDMA).
+
+	  To compile this driver as module, choose M here.
diff --git a/drivers/infiniband/hw/erdma/Makefile b/drivers/infiniband/hw/erdma/Makefile
new file mode 100644
index 000000000000..51d2ef91905a
--- /dev/null
+++ b/drivers/infiniband/hw/erdma/Makefile
@@ -0,0 +1,4 @@ 
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_INFINIBAND_ERDMA) := erdma.o
+
+erdma-y := erdma_cm.o erdma_main.o erdma_cmdq.o erdma_cq.o erdma_verbs.o erdma_qp.o erdma_eq.o