linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Meir Lichtinger <meirl@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
	Yishai Hadas <yishaih@nvidia.com>
Subject: Re: [PATCH rdma-next 2/2] IB/mlx5: Enable UAR to have DevX UID
Date: Wed, 15 Sep 2021 10:47:53 -0300	[thread overview]
Message-ID: <20210915134753.GA212159@nvidia.com> (raw)
In-Reply-To: <b6580419a845f750014df75f6ee1916cc3f0d2d7.1631660943.git.leonro@nvidia.com>

On Wed, Sep 15, 2021 at 02:11:23AM +0300, Leon Romanovsky wrote:
> From: Meir Lichtinger <meirl@nvidia.com>
> 
> UID field was added to alloc_uar and dealloc_uar PRM command, to specify
> DevX UID for UAR. This change enables firmware validating user access to
> its own UAR resources.
> 
> For the kernel allocated UARs the UID will stay 0 as of today.
> 
> Signed-off-by: Meir Lichtinger <meirl@nvidia.com>
> Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
>  drivers/infiniband/hw/mlx5/cmd.c  | 24 ++++++++++++++
>  drivers/infiniband/hw/mlx5/cmd.h  |  2 ++
>  drivers/infiniband/hw/mlx5/main.c | 55 +++++++++++++++++--------------
>  3 files changed, 57 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/cmd.c b/drivers/infiniband/hw/mlx5/cmd.c
> index a8db8a051170..0fe3c4ceec43 100644
> +++ b/drivers/infiniband/hw/mlx5/cmd.c
> @@ -206,3 +206,27 @@ int mlx5_cmd_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb,
>  	kfree(in);
>  	return err;
>  }
> +
> +int mlx5_ib_cmd_uar_alloc(struct mlx5_core_dev *dev, u32 *uarn, u16 uid)
> +{
> +	u32 out[MLX5_ST_SZ_DW(alloc_uar_out)] = {};
> +	u32 in[MLX5_ST_SZ_DW(alloc_uar_in)] = {};
> +	int err;
> +
> +	MLX5_SET(alloc_uar_in, in, opcode, MLX5_CMD_OP_ALLOC_UAR);
> +	MLX5_SET(alloc_uar_in, in, uid, uid);
> +	err = mlx5_cmd_exec_inout(dev, alloc_uar, in, out);
> +	if (!err)
> +		*uarn = MLX5_GET(alloc_uar_out, out, uar);

Success oriented flow:

 if (err)
     return err;
 *uarn = MLX5_GET(alloc_uar_out, out, uar);
 return 0;

And why did we add entirely new functions instead of just adding a uid
argument to the core ones? Or, why doesn't this delete the old core
functions that look unused outside of IB anyhow?

Jason

  reply	other threads:[~2021-09-15 13:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 23:11 [PATCH rdma-next 0/2] Extend " Leon Romanovsky
2021-09-14 23:11 ` [PATCH mlx5-next 1/2] net/mlx5: Add uid field to UAR allocation structures Leon Romanovsky
2021-09-14 23:11 ` [PATCH rdma-next 2/2] IB/mlx5: Enable UAR to have DevX UID Leon Romanovsky
2021-09-15 13:47   ` Jason Gunthorpe [this message]
2021-09-20 13:21     ` Leon Romanovsky

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=20210915134753.GA212159@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=meirl@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=yishaih@nvidia.com \
    --subject='Re: [PATCH rdma-next 2/2] IB/mlx5: Enable UAR to have DevX UID' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).