public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <elic@nvidia.com>,
	mst@redhat.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] vdpa/mlx5: Support creating resources with uid == 0
Date: Mon, 31 May 2021 11:02:21 +0800	[thread overview]
Message-ID: <7e4f741e-e595-fe19-91ef-e6faeec765d4@redhat.com> (raw)
In-Reply-To: <20210530075415.4644-2-elic@nvidia.com>


在 2021/5/30 下午3:54, Eli Cohen 写道:
> Currently all resources must be created with uid != 0 which is essential
> userspace processes allocating virtquueue resources. Since this is a
> kernel implementation, it is perfectly legal to open resources with
> uid == 0.
>
> In case frimware supports, avoid allocating user context.


Typo "frimware".

Otherwise.

Acked-by: Jason Wang <jasowang@redhat.com>

(I don't see any code to check the firmware capability, is this intended?)

Thanks


>
> Signed-off-by: Eli Cohen <elic@nvidia.com>
> ---
>   drivers/vdpa/mlx5/core/resources.c | 6 ++++++
>   include/linux/mlx5/mlx5_ifc.h      | 4 +++-
>   2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/core/resources.c b/drivers/vdpa/mlx5/core/resources.c
> index 6521cbd0f5c2..836ab9ef0fa6 100644
> --- a/drivers/vdpa/mlx5/core/resources.c
> +++ b/drivers/vdpa/mlx5/core/resources.c
> @@ -54,6 +54,9 @@ static int create_uctx(struct mlx5_vdpa_dev *mvdev, u16 *uid)
>   	void *in;
>   	int err;
>   
> +	if (MLX5_CAP_GEN(mvdev->mdev, umem_uid_0))
> +		return 0;
> +
>   	/* 0 means not supported */
>   	if (!MLX5_CAP_GEN(mvdev->mdev, log_max_uctx))
>   		return -EOPNOTSUPP;
> @@ -79,6 +82,9 @@ static void destroy_uctx(struct mlx5_vdpa_dev *mvdev, u32 uid)
>   	u32 out[MLX5_ST_SZ_DW(destroy_uctx_out)] = {};
>   	u32 in[MLX5_ST_SZ_DW(destroy_uctx_in)] = {};
>   
> +	if (!uid)
> +		return;
> +
>   	MLX5_SET(destroy_uctx_in, in, opcode, MLX5_CMD_OP_DESTROY_UCTX);
>   	MLX5_SET(destroy_uctx_in, in, uid, uid);
>   
> diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
> index 9c68b2da14c6..606d2aeacad4 100644
> --- a/include/linux/mlx5/mlx5_ifc.h
> +++ b/include/linux/mlx5/mlx5_ifc.h
> @@ -1487,7 +1487,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
>   	u8         uar_4k[0x1];
>   	u8         reserved_at_241[0x9];
>   	u8         uar_sz[0x6];
> -	u8         reserved_at_250[0x8];
> +	u8         reserved_at_248[0x2];
> +	u8         umem_uid_0[0x1];
> +	u8         reserved_at_250[0x5];
>   	u8         log_pg_sz[0x8];
>   
>   	u8         bf[0x1];


  reply	other threads:[~2021-05-31  3:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30  7:54 [PATCH 0/2] vdpa/mlx5: Add support for virtio_vdpa Eli Cohen
2021-05-30  7:54 ` [PATCH 1/2] vdpa/mlx5: Support creating resources with uid == 0 Eli Cohen
2021-05-31  3:02   ` Jason Wang [this message]
2021-05-31  3:06     ` Jason Wang
2021-05-31  4:59       ` Eli Cohen
2021-05-31  6:43         ` Jason Wang
2021-05-31  4:58     ` Eli Cohen
2021-05-30  7:54 ` [PATCH 2/2] vdpa/mlx5: Add support for running with virtio_vdpa Eli Cohen
2021-05-31  3:16   ` Jason Wang
2021-05-31  5:13     ` Eli Cohen
2021-05-31  6:44       ` Jason Wang

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=7e4f741e-e595-fe19-91ef-e6faeec765d4@redhat.com \
    --to=jasowang@redhat.com \
    --cc=elic@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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