From: Jason Gunthorpe <jgg@ziepe.ca>
To: Serhat Kumral <serhatkumral1@gmail.com>
Cc: linux-rdma@vger.kernel.org,
Potnuri Bharat Teja <bharat@chelsio.com>,
Leon Romanovsky <leon@kernel.org>,
Roland Dreier <rolanddreier@rivian.com>,
Steve Wise <larrystevenwise@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/cxgb4: Unmap BAR2 when c4iw_rdev_open() fails
Date: Mon, 23 Nov 2026 12:51:28 -0400 [thread overview]
Message-ID: <20261123165128.GL179082@ziepe.ca> (raw)
In-Reply-To: <20261122135413.93813-1-serhatkumral1@gmail.com>
On Sun, Nov 22, 2026 at 04:54:13PM +0300, Serhat Kumral wrote:
> c4iw_alloc() maps BAR2 on T5/T6 devices or its on-chip queue region
> on T4 devices. If c4iw_rdev_open() fails, c4iw_alloc() releases the
> IB device but leaves the mapping in place.
>
> Unmap the mapped region before releasing the IB device.
>
> Fixes: c6d7b26791a2 ("RDMA/cxgb4: Support on-chip SQs")
> Fixes: fa658a98a2d0 ("RDMA/cxgb4: Use the BAR2/WC path for kernel QPs and T5 devices")
> Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
> ---
> drivers/infiniband/hw/cxgb4/device.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
> index 24ac9871ce67..35dacf379294 100644
> --- a/drivers/infiniband/hw/cxgb4/device.c
> +++ b/drivers/infiniband/hw/cxgb4/device.c
> @@ -1046,6 +1046,10 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
> ret = c4iw_rdev_open(&devp->rdev);
> if (ret) {
> pr_err("Unable to open CXIO rdev err %d\n", ret);
> + if (devp->rdev.bar2_kva)
> + iounmap(devp->rdev.bar2_kva);
> + if (devp->rdev.oc_mw_kva)
> + iounmap(devp->rdev.oc_mw_kva);
> ib_dealloc_device(&devp->ibdev);
> return ERR_PTR(ret);
You should refactor things so c4iw uses the
device->ops.dealloc_driver(device);
Call and puts stuff like this in there
Existing c4iw_dealloc() is possibly close to what should be in the op.
Jason
prev parent reply other threads:[~2026-11-23 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 13:54 [PATCH] RDMA/cxgb4: Unmap BAR2 when c4iw_rdev_open() fails Serhat Kumral
2026-11-22 13:57 ` sashiko-bot
2026-11-23 16:51 ` Jason Gunthorpe [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=20261123165128.GL179082@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=bharat@chelsio.com \
--cc=larrystevenwise@gmail.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=rolanddreier@rivian.com \
--cc=serhatkumral1@gmail.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