Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Yanze Zhang <zhang.yanze@zte.com.cn>
Cc: jgg@ziepe.ca, julianbraha@gmail.com, huangjunxian6@hisilicon.com,
	yanjun.zhu@linux.dev, Markus.Elfring@web.de, lkp@intel.com,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	wei.quan@zte.com.cn, han.junyang@zte.com.cn, ran.ming@zte.com.cn,
	han.chengfei@zte.com.cn
Subject: Re: [PATCH rdma v10 7/7] RDMA/zrdma: Implement context, PD, and mmap operations
Date: Thu, 3 Dec 2026 22:06:52 +0200	[thread overview]
Message-ID: <20261203200652.GA31440@unreal> (raw)
In-Reply-To: <20261203124928.48716-8-zhang.yanze@zte.com.cn>

On Thu, Dec 03, 2026 at 08:49:28PM +0800, Yanze Zhang wrote:
> Add implementation for allocation/deallocation of Protection Domains (PD),
> User Contexts, and memory mapping (mmap) for doorbells.
> 
> The SRQ doorbell area is not page aligned on 16K and 64K page systems, so
> the mapping length is extended to the page boundary and the size
> reported to userspace is the very same length. The V1 and V2 contexts do
> not know the size of the SRQ doorbell area, so only the first page is
> mapped for them.
> 
> Signed-off-by: Yanze Zhang <zhang.yanze@zte.com.cn>
> ---
>  drivers/infiniband/hw/zrdma/zrdma_verbs.c | 351 ++++++++++++++++++++++
>  1 file changed, 351 insertions(+)

<...>

> +	if (err) {
> +		pr_warn_ratelimited("zrdma: PD allocation failed err=%d\n",
> +				    err);
> +		return err;
> +	}
> +
> +	sc_pd = &zpd->sc_pd;
> +	if (udata) {
> +		struct zxdh_ucontext *ucontext;
> +
> +		ucontext = rdma_udata_to_drv_context(udata,
> +						     struct zxdh_ucontext,
> +						     ibucontext);
> +
> +		zxdh_sc_pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
> +		uresp.pd_id = pd_id;
> +		if (ib_respond_udata(udata, uresp)) {
> +			err = -EFAULT;
> +			goto error;
> +		}
> +	} else {
> +		/* A protection domain that the kernel allocates has no user
> +		 * context, it uses the default ABI version.
> +		 */
> +		zxdh_sc_pd_init(dev, sc_pd, pd_id, ZXDH_ABI_VER);
> +	}

<...>

> +	struct zxdh_user_mmap_entry *entry =
> +		kzalloc(sizeof(*entry), GFP_KERNEL);

I haven't reviewed the entire series, but a few things immediately caught
my attention:

First, the series is structured incorrectly. Add the callbacks at the
beginning, and make the final patch enable the driver for users by adding
a Kbuild entry or a driver_id.

Second, use kzalloc_obj instead of kzalloc.

Third, replace the pr_*() calls with ibdev_*() calls.

Finally, ABI does not apply to in-kernel users. I also strongly suspect
that it is not being used correctly for uverbs too.

Thanks

      parent reply	other threads:[~2026-12-03 20:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 12:49 [PATCH rdma v10 0/7] Add ZTE DingHai Ethernet Protocol Driver for RDMA Yanze Zhang
2026-12-03 12:49 ` [PATCH rdma v10 1/7] RDMA/zrdma: Add build infrastructure and module skeleton Yanze Zhang
2026-12-03 13:19   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 2/7] RDMA/zrdma: Add core data structures and ABI definitions Yanze Zhang
2026-12-03 13:21   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 3/7] RDMA/zrdma: Add internal headers and hardware register definitions Yanze Zhang
2026-12-03 13:17   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 4/7] RDMA/zrdma: Add hardware resource initialization and verbs skeleton Yanze Zhang
2026-12-03 13:20   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 5/7] RDMA/zrdma: Implement device and port query operations Yanze Zhang
2026-12-03 13:32   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 6/7] RDMA/zrdma: Add device probe and remove logic Yanze Zhang
2026-12-03 13:28   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 7/7] RDMA/zrdma: Implement context, PD, and mmap operations Yanze Zhang
2026-12-03 13:42   ` sashiko-bot
2026-12-03 20:06   ` Leon Romanovsky [this message]

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=20261203200652.GA31440@unreal \
    --to=leon@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=han.chengfei@zte.com.cn \
    --cc=han.junyang@zte.com.cn \
    --cc=huangjunxian6@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=julianbraha@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=ran.ming@zte.com.cn \
    --cc=wei.quan@zte.com.cn \
    --cc=yanjun.zhu@linux.dev \
    --cc=zhang.yanze@zte.com.cn \
    /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