public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Yishai Hadas <yishaih@mellanox.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: [PATCH rdma-rc] RDMA/mlx5: Fix compilation breakage without INFINIBAND_USER_ACCESS
Date: Thu, 30 Jan 2020 05:38:45 -0800	[thread overview]
Message-ID: <cfba94b4-9729-8a28-3ab2-23d06b3fce8e@infradead.org> (raw)
In-Reply-To: <20200130112957.337869-1-leon@kernel.org>

On 1/30/20 3:29 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Compilation of mlx5 driver without CONFIG_INFINIBAND_USER_ACCESS generates
> the following error.
> 
> on x86_64:
> 
> ld: drivers/infiniband/hw/mlx5/main.o: in function `mlx5_ib_handler_MLX5_IB_METHOD_VAR_OBJ_ALLOC':
> main.c:(.text+0x186d): undefined reference to `ib_uverbs_get_ucontext_file'
> ld: drivers/infiniband/hw/mlx5/main.o:(.rodata+0x2480): undefined reference to `uverbs_idr_class'
> ld: drivers/infiniband/hw/mlx5/main.o:(.rodata+0x24d8): undefined reference to `uverbs_destroy_def_handler'
> 
> Guard the problematic code, so VAR objects API won't be compiled without CONFIG_INFINIBAND_USER_ACCESS.
> 
> Fixes: 7be76bef320b ("IB/mlx5: Introduce VAR object and its alloc/destroy methods")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  drivers/infiniband/hw/mlx5/main.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 41ccc19d229e..c2afe6929cbb 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -2280,15 +2280,6 @@ static int mlx5_ib_mmap_offset(struct mlx5_ib_dev *dev,
>  	return ret;
>  }
> 
> -static u64 mlx5_entry_to_mmap_offset(struct mlx5_user_mmap_entry *entry)
> -{
> -	u16 cmd = entry->rdma_entry.start_pgoff >> 16;
> -	u16 index = entry->rdma_entry.start_pgoff & 0xFFFF;
> -
> -	return (((index >> 8) << 16) | (cmd << MLX5_IB_MMAP_CMD_SHIFT) |
> -		(index & 0xFF)) << PAGE_SHIFT;
> -}
> -
>  static int mlx5_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vma)
>  {
>  	struct mlx5_ib_ucontext *context = to_mucontext(ibcontext);
> @@ -6085,6 +6076,16 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev)
>  	mlx5_nic_vport_disable_roce(dev->mdev);
>  }
> 
> +#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
> +static u64 mlx5_entry_to_mmap_offset(struct mlx5_user_mmap_entry *entry)
> +{
> +	u16 cmd = entry->rdma_entry.start_pgoff >> 16;
> +	u16 index = entry->rdma_entry.start_pgoff & 0xFFFF;
> +
> +	return (((index >> 8) << 16) | (cmd << MLX5_IB_MMAP_CMD_SHIFT) |
> +		(index & 0xFF)) << PAGE_SHIFT;
> +}
> +
>  static int var_obj_cleanup(struct ib_uobject *uobject,
>  			   enum rdma_remove_reason why,
>  			   struct uverbs_attr_bundle *attrs)
> @@ -6223,6 +6224,7 @@ static bool var_is_supported(struct ib_device *device)
>  	return (MLX5_CAP_GEN_64(dev->mdev, general_obj_types) &
>  			MLX5_GENERAL_OBJ_TYPES_CAP_VIRTIO_NET_Q);
>  }
> +#endif
> 
>  ADD_UVERBS_ATTRIBUTES_SIMPLE(
>  	mlx5_ib_dm,
> @@ -6254,8 +6256,10 @@ static const struct uapi_definition mlx5_ib_defs[] = {
>  	UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION,
>  				&mlx5_ib_flow_action),
>  	UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_DM, &mlx5_ib_dm),
> +#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
>  	UAPI_DEF_CHAIN_OBJ_TREE_NAMED(MLX5_IB_OBJECT_VAR,
>  				UAPI_DEF_IS_OBJ_SUPPORTED(var_is_supported)),
> +#endif
>  	{}
>  };
> 
> --
> 2.24.1
> 


-- 
~Randy


  reply	other threads:[~2020-01-30 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 11:29 [PATCH rdma-rc] RDMA/mlx5: Fix compilation breakage without INFINIBAND_USER_ACCESS Leon Romanovsky
2020-01-30 13:38 ` Randy Dunlap [this message]
2020-01-30 15:34 ` Jason Gunthorpe
2020-01-30 15:47   ` Leon Romanovsky
2020-01-30 16:26   ` Randy Dunlap
2020-01-30 20:43     ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfba94b4-9729-8a28-3ab2-23d06b3fce8e@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=leon@kernel.org \
    --cc=leonro@mellanox.com \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=yishaih@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox