RDMA: Explicitly pass in the dma_device to ib_register_device
Subsystems (14)
PATCH v2 1/1 RDMA: Explicitly pass in the dma_device to ib_register_device
From: Jason Gunthorpe <[email protected]>
The code in setup_dma_device has become rather convoluted, move all of this to the drivers. Drives now pass in a DMA capable struct device which will be used to setup DMA, or drivers must fully configure the ibdev for DMA and pass in NULL.
Other than setting the masks in rvt all drivers were doing this already anyhow.
mthca, mlx4 and mlx5 were already setting up maximum DMA segment size for DMA based on their hardweare limits in:__mthca_init_one()
dma_set_max_seg_size (1G)
__mlx4_init_one()
dma_set_max_seg_size (1G)
mlx5_pci_init()
set_dma_caps()
dma_set_max_seg_size (2G)
Other non software drivers (except usnic) were extended to UINT_MAX [1, 2] instead of 2G as was before.
[1] https://lore.kernel.org/linux-rdma/[email protected]/
[2] https://lore.kernel.org/linux-rdma/[email protected]/
---
Changelog
v2:
* Simplified setup_dma_device() by removing extra if()s over various WARN_ON().
v1: https://lore.kernel.org/linux-rdma/[email protected]
* Moved dma_set_max_seg_size() to be part of the drivers and increased the limit to UINT_MAX.
--- drivers/infiniband/core/device.c | 65 +++++-------------- drivers/infiniband/hw/bnxt_re/main.c | 3 +- drivers/infiniband/hw/cxgb4/provider.c | 4 +- drivers/infiniband/hw/efa/efa_main.c | 4 +- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 3 +- drivers/infiniband/hw/mlx4/main.c | 3 +- drivers/infiniband/hw/mlx5/main.c | 2 +- drivers/infiniband/hw/mthca/mthca_provider.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 4 +- drivers/infiniband/hw/qedr/main.c | 3 +- drivers/infiniband/hw/usnic/usnic_ib_main.c | 3 +- .../infiniband/hw/vmw_pvrdma/pvrdma_main.c | 4 +- drivers/infiniband/sw/rdmavt/vt.c | 8 ++- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- drivers/infiniband/sw/siw/siw_main.c | 4 +- include/rdma/ib_verbs.h | 3 +- 17 files changed, 51 insertions(+), 69 deletions(-)
drivers/infiniband/core/device.c +15 -50
@@ -1177,58 +1177,22 @@ static int assign_name(struct ib_device *device, const char *name)return ret; } -static void setup_dma_device (struct ib_device *device) +static void setup_dma_device (struct ib_device *device, +struct device *dma_device) { -struct device *parent = device->dev.parent; - -WARN_ON_ONCE (device->dma_device); - -#ifdef CONFIG_DMA_OPS -if (device->dev.dma_ops) { -/* -* The caller provided custom DMA operations. Copy the -* DMA-related fields that are used by e.g. dma_alloc_coherent() -* into device->dev. -*/ - device->dma_device = &device->dev; -if (!device->dev.dma_mask) { -if (parent) - device->dev.dma_mask = parent->dma_mask; -else -WARN_ON_ONCE (true); - } -if (!device->dev.coherent_dma_mask) { -if (parent) - device->dev.coherent_dma_mask = - parent->coherent_dma_mask; -else -WARN_ON_ONCE (true); - } - } else -#endif /* CONFIG_DMA_OPS */ - { +WARN_ON (!IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && !dma_device); +if (!dma_device) {/* -* The caller did not provide custom DMA operations. Use the -* DMA mapping operations of the parent device. +* If the caller does not provide a DMA capable device then the +* IB device will be used. In this case the caller should fully +* setup the ibdev for DMA. This usually means using +* dma_virt_ops. */ -WARN_ON_ONCE (!parent); - device->dma_device = parent; - } - -if (!device->dev.dma_parms) { -if (parent) { -/* -* The caller did not provide DMA parameters, so -* 'parent' probably represents a PCI device. The PCI -* core sets the maximum segment size to 64 -* KB. Increase this parameter to 2 GB. -*/ - device->dev.dma_parms = parent->dma_parms; -dma_set_max_seg_size (device->dma_device,SZ_2G ); - }else { -WARN_ON_ONCE (true); - } + device->dev.dma_ops = &dma_virt_ops; + dma_device = &device->dev; } + device->dma_device = dma_device; +WARN_ON (!device->dma_device->dma_parms); }/*
@@ -1241,7 +1205,6 @@ static int setup_device(struct ib_device *device)struct ib_udata uhw = {.outlen =0 , .inlen =0 };int ret; -setup_dma_device (device);ib_device_check_mandatory (device); ret =setup_port_data (device);
@@ -1361,7 +1324,8 @@ static void prevent_dealloc_device(struct ib_device *ib_dev)* asynchronously then the device pointer may become freed as soon as this * function returns. */ -int ib_register_device (struct ib_device *device,const char *name) +int ib_register_device (struct ib_device *device,const char *name, +struct device *dma_device) {int ret;
@@ -1369,6 +1333,7 @@ int ib_register_device(struct ib_device *device, const char *name)if (ret)return ret; +setup_dma_device (device, dma_device); ret =setup_device (device);if (ret)return ret;
drivers/infiniband/hw/bnxt_re/main.c +2 -1
@@ -736,7 +736,8 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)if (ret)return ret; -return ib_register_device (ibdev,"bnxt_re%d" ); +dma_set_max_seg_size (&rdev->en_dev->pdev->dev,UINT_MAX ); +return ib_register_device (ibdev,"bnxt_re%d" , &rdev->en_dev->pdev->dev); }static void bnxt_re_dev_remove (struct bnxt_re_dev *rdev)
drivers/infiniband/hw/cxgb4/provider.c +3 -1
@@ -570,7 +570,9 @@ void c4iw_register_device(struct work_struct *work) ret =set_netdevs (&dev->ibdev, &dev->rdev);if (ret) goto err_dealloc_ctx; - ret =ib_register_device (&dev->ibdev,"cxgb4_%d" ); +dma_set_max_seg_size (&dev->rdev.lldi.pdev->dev,UINT_MAX ); + ret =ib_register_device (&dev->ibdev,"cxgb4_%d" , + &dev->rdev.lldi.pdev->dev);if (ret) goto err_dealloc_ctx;return ;
drivers/infiniband/hw/efa/efa_main.c +2 -2
@@ -331,7 +331,7 @@ static int efa_ib_device_add(struct efa_dev *dev)ib_set_device_ops (&dev->ibdev, &efa_dev_ops); - err =ib_register_device (&dev->ibdev,"efa_%d" ); + err =ib_register_device (&dev->ibdev,"efa_%d" , &pdev->dev);if (err) goto err_release_doorbell_bar;
@@ -418,7 +418,7 @@ static int efa_device_init(struct efa_com_dev *edev, struct pci_dev *pdev) err);return err; } - +dma_set_max_seg_size (&pdev->dev,UINT_MAX );return 0 ; }
drivers/infiniband/hw/hns/hns_roce_main.c +2 -1
@@ -549,7 +549,8 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)if (ret)return ret; } - ret =ib_register_device (ib_dev,"hns_%d" ); +dma_set_max_seg_size (dev,UINT_MAX ); + ret =ib_register_device (ib_dev,"hns_%d" , dev);if (ret) {dev_err (dev,"ib_register_device failed!\n" );return ret;
drivers/infiniband/hw/i40iw/i40iw_verbs.c +2 -1
@@ -2761,7 +2761,8 @@ int i40iw_register_rdma_device(struct i40iw_device *iwdev)if (ret) goto error; - ret =ib_register_device (&iwibdev->ibdev,"i40iw%d" ); +dma_set_max_seg_size (&iwdev->hw.pcidev->dev,UINT_MAX ); + ret =ib_register_device (&iwibdev->ibdev,"i40iw%d" , &iwdev->hw.pcidev->dev);if (ret) goto error;
drivers/infiniband/hw/mlx4/main.c +2 -1
@@ -2841,7 +2841,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) goto err_steer_free_bitmap;rdma_set_device_sysfs_group (&ibdev->ib_dev, &mlx4_attr_group); -if (ib_register_device (&ibdev->ib_dev,"mlx4_%d" )) +if (ib_register_device (&ibdev->ib_dev,"mlx4_%d" , + &dev->persist->pdev->dev)) goto err_diag_counters;if (mlx4_ib_mad_init (ibdev))
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -4404,7 +4404,7 @@ static int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev) name ="mlx5_%d" ; else name ="mlx5_bond_%d" ; -return ib_register_device (&dev->ib_dev, name); +return ib_register_device (&dev->ib_dev, name, &dev->mdev->pdev->dev); }static void mlx5_ib_stage_pre_ib_reg_umr_cleanup (struct mlx5_ib_dev *dev)
drivers/infiniband/hw/mthca/mthca_provider.c +1 -1
@@ -1206,7 +1206,7 @@ int mthca_register_device(struct mthca_dev *dev)mutex_init (&dev->cap_mask_mutex);rdma_set_device_sysfs_group (&dev->ib_dev, &mthca_attr_group); - ret =ib_register_device (&dev->ib_dev,"mthca%d" ); + ret =ib_register_device (&dev->ib_dev,"mthca%d" , &dev->pdev->dev);if (ret)return ret;
drivers/infiniband/hw/ocrdma/ocrdma_main.c +3 -1
@@ -255,7 +255,9 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)if (ret)return ret; -return ib_register_device (&dev->ibdev,"ocrdma%d" ); +dma_set_max_seg_size (&dev->nic_info.pdev->dev,UINT_MAX ); +return ib_register_device (&dev->ibdev,"ocrdma%d" , + &dev->nic_info.pdev->dev); }static int ocrdma_alloc_resources (struct ocrdma_dev *dev)
drivers/infiniband/hw/qedr/main.c +2 -1
@@ -293,7 +293,8 @@ static int qedr_register_device(struct qedr_dev *dev)if (rc)return rc; -return ib_register_device (&dev->ibdev,"qedr%d" ); +dma_set_max_seg_size (&dev->pdev->dev,UINT_MAX ); +return ib_register_device (&dev->ibdev,"qedr%d" , &dev->pdev->dev); }/* This function allocates fast-path status block memory */
drivers/infiniband/hw/usnic/usnic_ib_main.c +2 -1
@@ -425,7 +425,8 @@ static void *usnic_ib_device_add(struct pci_dev *dev)if (ret) goto err_fwd_dealloc; -if (ib_register_device (&us_ibdev->ib_dev,"usnic_%d" )) +dma_set_max_seg_size (&dev->dev,SZ_2G ); +if (ib_register_device (&us_ibdev->ib_dev,"usnic_%d" , &dev->dev)) goto err_fwd_dealloc;usnic_fwd_set_mtu (us_ibdev->ufdev, us_ibdev->netdev->mtu);
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +2 -2
@@ -270,7 +270,7 @@ static int pvrdma_register_device(struct pvrdma_dev *dev)spin_lock_init (&dev->srq_tbl_lock);rdma_set_device_sysfs_group (&dev->ib_dev, &pvrdma_attr_group); - ret =ib_register_device (&dev->ib_dev,"vmw_pvrdma%d" ); + ret =ib_register_device (&dev->ib_dev,"vmw_pvrdma%d" , &dev->pdev->dev);if (ret) goto err_srq_free;
@@ -854,7 +854,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, goto err_free_resource; } } - +dma_set_max_seg_size (&pdev->dev,UINT_MAX );pci_set_master (pdev);/* Map register space */
drivers/infiniband/sw/rdmavt/vt.c +6 -2
@@ -581,7 +581,11 @@ int rvt_register_device(struct rvt_dev_info *rdi)spin_lock_init (&rdi->n_cqs_lock);/* DMA Operations */ - rdi->ibdev.dev.dma_ops = rdi->ibdev.dev.dma_ops ? : &dma_virt_ops; + rdi->ibdev.dev.dma_ops = &dma_virt_ops; + rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; + rdi->ibdev.dev.dma_mask = rdi->ibdev.dev.parent->dma_mask; + rdi->ibdev.dev.coherent_dma_mask = + rdi->ibdev.dev.parent->coherent_dma_mask;/* Protection Domain */ spin_lock_init (&rdi->n_pds_lock);
@@ -629,7 +633,7 @@ int rvt_register_device(struct rvt_dev_info *rdi) rdi->ibdev.num_comp_vectors =1 ;/* We are now good to announce we exist */ - ret =ib_register_device (&rdi->ibdev,dev_name (&rdi->ibdev.dev)); + ret =ib_register_device (&rdi->ibdev,dev_name (&rdi->ibdev.dev),NULL );if (ret) {rvt_pr_err (rdi,"Failed to register driver with ib core.\n" ); goto bail_wss;
drivers/infiniband/sw/rxe/rxe_verbs.c +1 -1
@@ -1182,7 +1182,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) rxe->tfm = tfm;rdma_set_device_sysfs_group (dev, &rxe_attr_group); - err =ib_register_device (dev, ibdev_name); + err =ib_register_device (dev, ibdev_name,NULL );if (err)pr_warn ("%s failed with error %d\n" , __func__, err);
drivers/infiniband/sw/siw/siw_main.c +3 -1
@@ -69,7 +69,7 @@ static int siw_device_register(struct siw_device *sdev, const char *name) sdev->vendor_part_id = dev_id++; - rv =ib_register_device (base_dev, name); + rv =ib_register_device (base_dev, name,NULL );if (rv) {pr_warn ("siw: device registration error %d\n" , rv);return rv;
@@ -386,6 +386,8 @@ static struct siw_device *siw_device_create(struct net_device *netdev) base_dev->dev.dma_parms = &sdev->dma_parms; sdev->dma_parms = (struct device_dma_parameters ) { .max_segment_size =SZ_2G }; +dma_coerce_mask_and_coherent (&base_dev->dev, +dma_get_required_mask (&base_dev->dev)); base_dev->num_comp_vectors =num_possible_cpus ();xa_init_flags (&sdev->qp_xa,XA_FLAGS_ALLOC1 );
include/rdma/ib_verbs.h +2 -1
@@ -2782,7 +2782,8 @@ void ib_dealloc_device(struct ib_device *device);void ib_get_device_fw_str (struct ib_device *device,char *str); -int ib_register_device (struct ib_device *device,const char *name); +int ib_register_device (struct ib_device *device,const char *name, +struct device *dma_device);void ib_unregister_device (struct ib_device *device);void ib_unregister_driver (enum rdma_driver_id driver_id);void ib_unregister_device_and_put (struct ib_device *device);
--
2.26.2
drivers/infiniband/core/device.c static int assign_name(struct ib_device *device, const char *name) · line 1192
Quoted 12 lines
drivers/infiniband/core/device.c +8
-2+WARN_ON (!IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && !dma_device); +if (!dma_device) {/* -* The caller did not provide custom DMA operations. Use the -* DMA mapping operations of the parent device. +* If the caller does not provide a DMA capable device then the +* IB device will be used. In this case the caller should fully +* setup the ibdev for DMA. This usually means using +* dma_virt_ops. */ + device->dev.dma_ops = &dma_virt_ops; + dma_device = &device->dev;
The lack of the if probably means this will fail to link now when CONFIG_DMA_VIRT_OPS is not set. This also seems to not remove the dma_virt_ops assignment in the callers.
drivers/infiniband/sw/rdmavt/vt.c int rvt_register_device(struct rvt_dev_info *rdi) · line 586
Quoted 11 lines
index
f904bb34477a..2f117ac11c8b100644drivers/infiniband/sw/rdmavt/vt.c +3
-1@@ -581,7 +581,11 @@ int rvt_register_device(struct rvt_dev_info *rdi)spin_lock_init (&rdi->n_cqs_lock);/* DMA Operations */ - rdi->ibdev.dev.dma_ops = rdi->ibdev.dev.dma_ops ? : &dma_virt_ops; + rdi->ibdev.dev.dma_ops = &dma_virt_ops; + rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; + rdi->ibdev.dev.dma_mask = rdi->ibdev.dev.parent->dma_mask;
This copies the dma_mask pointer, which seems completely bogus.
Quoted 8 lines · Christoph Hellwig
Quoted 8 lines
drivers/infiniband/core/device.c +5
-2+WARN_ON (!IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && !dma_device); +if (!dma_device) {/* -* The caller did not provide custom DMA operations. Use the -* DMA mapping operations of the parent device. +* If the caller does not provide a DMA capable device then the +* IB device will be used. In this case the caller should fully +* setup the ibdev for DMA. This usually means using
Quoted 8 lines
drivers/infiniband/core/device.c static int assign_name(struct ib_device *device, const char *name) · line 1192
Quoted 4 lines
drivers/infiniband/core/device.c +3
-0+* dma_virt_ops. */ + device->dev.dma_ops = &dma_virt_ops; + dma_device = &device->dev;The lack of the if probably means this will fail to link now when
CONFIG_DMA_VIRT_OPSis not set. This also seems to not remove thedma_virt_opsassignment in the callers.
I expect to see this during driver development/testing. It is not worth to make if() case id device won't be operable.
Thanks
Quoted 18 lines · Leon Romanovsky
Quoted 8 lines · Christoph Hellwig
Quoted 8 lines
drivers/infiniband/core/device.c +5
-2+WARN_ON (!IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && !dma_device); +if (!dma_device) {/* -* The caller did not provide custom DMA operations. Use the -* DMA mapping operations of the parent device. +* If the caller does not provide a DMA capable device then the +* IB device will be used. In this case the caller should fully +* setup the ibdev for DMA. This usually means using Quoted 8 lines
drivers/infiniband/core/device.c static int assign_name(struct ib_device *device, const char *name) · line 1192
Quoted 4 lines
drivers/infiniband/core/device.c +3
-0+* dma_virt_ops. */ + device->dev.dma_ops = &dma_virt_ops; + dma_device = &device->dev;The lack of the if probably means this will fail to link now when
CONFIG_DMA_VIRT_OPSis not set. This also seems to not remove thedma_virt_opsassignment in the callers.
Quoted 2 lines
I expect to see this during driver development/testing. It is not worth to make
if()case id device won't be operable.
Then you'll need an ifdef or whatever your preferred method is to avoid the dma_virt_ops symbol reference for the !CONFIG_DMA_VIRT_OPS case.
Quoted 19 lines · Christoph Hellwig
Quoted 18 lines · Leon Romanovsky
Quoted 16 lines · Christoph Hellwig
Review
Quoted 12 lines
(quoted diff) +8
-2+ WARN_ON(!IS_ENABLED(CONFIG_DMA_VIRT_OPS) && !dma_device); + if (!dma_device) { /* - * The caller did not provide custom DMA operations. Use the - * DMA mapping operations of the parent device. + * If the caller does not provide a DMA capable device then the + * IB device will be used. In this case the caller should fully + * setup the ibdev for DMA. This usually means using + * dma_virt_ops. */ + device->dev.dma_ops = &dma_virt_ops; + dma_device = &device->dev;The lack of the if probably means this will fail to link now when
CONFIG_DMA_VIRT_OPSis not set. This also seems to not remove thedma_virt_opsassignment in the callers.
Quoted 6 lines
Quoted 2 lines
I expect to see this during driver development/testing. It is not worth to make
if()case id device won't be operable.Then you'll need an ifdef or whatever your preferred method is to avoid the
dma_virt_opssymbol reference for the !CONFIG_DMA_VIRT_OPS case.
drivers/infiniband/core/device.c +1 -1
@@ -1181,7 +1181,7 @@ static void setup_dma_device(struct ib_device *device, struct device *dma_device) {WARN_ON (!IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && !dma_device); -if (!dma_device) { +if (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && !dma_device) {/* * If the caller does not provide a DMA capable device then the * IB device will be used. In this case the caller should fully
Quoted 5 lines · Christoph Hellwig
Quoted 5 lines
index
f904bb34477a..2f117ac11c8b100644
+++b/drivers/infiniband/sw/rdmavt/vt.cdrivers/infiniband/sw/rdmavt/vt.c +0
-0@@ -581,7 +581,11 @@ int rvt_register_device(struct rvt_dev_info *rdi)spin_lock_init (&rdi->n_cqs_lock);
Quoted 7 lines
drivers/infiniband/sw/rdmavt/vt.c int rvt_register_device(struct rvt_dev_info *rdi) · line 586
Quoted 5 lines
drivers/infiniband/sw/rdmavt/vt.c +3
-1/* DMA Operations */ - rdi->ibdev.dev.dma_ops = rdi->ibdev.dev.dma_ops ? : &dma_virt_ops; + rdi->ibdev.dev.dma_ops = &dma_virt_ops; + rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; + rdi->ibdev.dev.dma_mask = rdi->ibdev.dev.parent->dma_mask;This copies the
dma_maskpointer, which seems completely bogus.
And pointless since virt_ops doesn't do anything with it?
Jason
kernel test robot
build botI love your patch! Yet something to improve:
Hi Leon,
I love your patch! Yet something to improve:
[auto build test ERROR on rdma/for-next]
[also build test ERROR on v5.9-rc8 next-20201002]
[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/Leon-Romanovsky/RDMA-Explicitly-pass-in-the-dma_device-to-ib_register_device/20201006-153413 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: ia64-defconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3b19b99ff8c7cbe60a42582791a53bcaed52849e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Leon-Romanovsky/RDMA-Explicitly-pass-in-the-dma_device-to-ib_register_device/20201006-153413 git checkout 3b19b99ff8c7cbe60a42582791a53bcaed52849e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "dma_virt_ops" [drivers/infiniband/core/ib_core.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botI love your patch! Yet something to improve:
Hi Leon,
I love your patch! Yet something to improve:
[auto build test ERROR on rdma/for-next]
[also build test ERROR on v5.9-rc8 next-20201002]
[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/Leon-Romanovsky/RDMA-Explicitly-pass-in-the-dma_device-to-ib_register_device/20201006-153413 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: riscv-randconfig-p002-20201005 (attached as .config) compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3b19b99ff8c7cbe60a42582791a53bcaed52849e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Leon-Romanovsky/RDMA-Explicitly-pass-in-the-dma_device-to-ib_register_device/20201006-153413 git checkout 3b19b99ff8c7cbe60a42582791a53bcaed52849e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
riscv32-linux-ld: drivers/infiniband/core/device.o: in function `assign_name':
>> drivers/infiniband/core/device.c:1157: undefined reference to `dma_virt_ops' >> riscv32-linux-ld: drivers/infiniband/core/device.c:1157: undefined reference to `dma_virt_ops'
vim +1157 drivers/infiniband/core/device.c
4e0f7b9070726a3 Parav Pandit 2019-02-26 1145
ecc82c53f9a4ce0 Leon Romanovsky 2017-06-18 1146 /*
d0899892edd0897 Jason Gunthorpe 2019-02-12 1147 * Assign the unique string device name and the unique device index. This is
d0899892edd0897 Jason Gunthorpe 2019-02-12 1148 * undone by ib_dealloc_device.
ecc82c53f9a4ce0 Leon Romanovsky 2017-06-18 1149 */
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1150 static int assign_name(struct ib_device *device, const char *name)
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1151 {
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1152 static u32 last_id;
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1153 int ret;
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1154
921eab1143aadf9 Jason Gunthorpe 2019-02-06 1155 down_write(&devices_rwsem);
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1156 /* Assign a unique name to the device */
0df91bb67334eeb Jason Gunthorpe 2019-02-06 @1157 if (strchr(name, '%'))
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1158 ret = alloc_name(device, name);
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1159 else
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1160 ret = dev_set_name(&device->dev, name);
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1161 if (ret)
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1162 goto out;
ecc82c53f9a4ce0 Leon Romanovsky 2017-06-18 1163
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1164 if (__ib_device_get_by_name(dev_name(&device->dev))) {
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1165 ret = -ENFILE;
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1166 goto out;
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1167 }
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1168 strlcpy(device->name, dev_name(&device->dev), IB_DEVICE_NAME_MAX);
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1169
ea295481b6e313b Linus Torvalds 2019-03-11 1170 ret = xa_alloc_cyclic(&devices, &device->index, device, xa_limit_31b,
ea295481b6e313b Linus Torvalds 2019-03-11 1171 &last_id, GFP_KERNEL);
ea295481b6e313b Linus Torvalds 2019-03-11 1172 if (ret > 0)
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1173 ret = 0;
921eab1143aadf9 Jason Gunthorpe 2019-02-06 1174
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1175 out:
921eab1143aadf9 Jason Gunthorpe 2019-02-06 1176 up_write(&devices_rwsem);
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1177 return ret;
ecc82c53f9a4ce0 Leon Romanovsky 2017-06-18 1178 }
0df91bb67334eeb Jason Gunthorpe 2019-02-06 1179 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org