On Tue, Feb 24, 2026 at 01:51:41PM +0800, Cheng Xu wrote:
> 
> 
> On 2/13/26 6:57 PM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <[email protected]>
> > 
> > Split CQ creation into distinct kernel and user flows. The erdma driver,
> > inherited from mlx4, uses a problematic pattern that shares and caches
> > umem in erdma_map_user_dbrecords(). This design blocks the driver from
> > supporting generic umem sources (VMA, dmabuf, memfd, and others).
> > 
> > Signed-off-by: Leon Romanovsky <[email protected]>
> > ---
> >  drivers/infiniband/hw/erdma/erdma_main.c  |  1 +
> >  drivers/infiniband/hw/erdma/erdma_verbs.c | 97 
> > ++++++++++++++++++++-----------
> >  drivers/infiniband/hw/erdma/erdma_verbs.h |  2 +
> >  3 files changed, 67 insertions(+), 33 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/erdma/erdma_main.c 
> > b/drivers/infiniband/hw/erdma/erdma_main.c
> > index f35b30235018..1b6426e89d80 100644
> > --- a/drivers/infiniband/hw/erdma/erdma_main.c
> > +++ b/drivers/infiniband/hw/erdma/erdma_main.c
> > @@ -505,6 +505,7 @@ static const struct ib_device_ops erdma_device_ops = {
> >     .alloc_pd = erdma_alloc_pd,
> >     .alloc_ucontext = erdma_alloc_ucontext,
> >     .create_cq = erdma_create_cq,
> > +   .create_user_cq = erdma_create_user_cq,
> >     .create_qp = erdma_create_qp,
> >     .dealloc_pd = erdma_dealloc_pd,
> >     .dealloc_ucontext = erdma_dealloc_ucontext,
> 
> <...>
> 
> > +
> > +int erdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
> > +               struct uverbs_attr_bundle *attrs)
> 
> create_cq will be used for kernel CQ creation, and the third input parameter
> 'struct uverbs_attr_bundle *attrs' will be useless, so it can be removed? 
> Same to
> all drivers.

Yes, but only after conversion of all drivers. I have that removal patch
in my v2.

> 
> 
> > +{
> 
> <...>
> 
> > +   ret = create_cq_cmd(NULL, cq);
> > +   if (ret)
> > +           goto err_free_res;
> 
> 
> In create_cq_cmd, should add the following change:

I took slightly different approach and inlined create_cq_cmd() into 
erdma_create_*_cq().

Thanks

> 
> diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c 
> b/drivers/infiniband/hw/erdma/erdma_verbs.c
> index 8c30df61ae3d..eca28524e04b 100644
> --- a/drivers/infiniband/hw/erdma/erdma_verbs.c
> +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
> @@ -240,7 +240,7 @@ static int create_cq_cmd(struct erdma_ucontext *uctx, 
> struct erdma_cq *cq)
>                 req.first_page_offset = mem->page_offset;
>                 req.cq_dbrec_dma = cq->user_cq.dbrec_dma;
>  
> -               if (uctx->ext_db.enable) {
> +               if (uctx && uctx->ext_db.enable) {
>                         req.cfg1 |= FIELD_PREP(
>                                 ERDMA_CMD_CREATE_CQ_MTT_DB_CFG_MASK, 1);
>                         req.cfg2 = FIELD_PREP(ERDMA_CMD_CREATE_CQ_DB_CFG_MASK,
> 
> 
> Thanks,
> Cheng Xu
> 

Reply via email to