From: Yishai Hadas <yishaih@nvidia.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Edward Srouji <edwards@nvidia.com>
Cc: "Leon Romanovsky" <leon@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH rdma-next 2/2] RDMA/mlx5: Implement DMABUF export ops
Date: Wed, 21 Jan 2026 12:35:55 +0200 [thread overview]
Message-ID: <6a18009f-c9ea-4026-ac68-8cb753f4b001@nvidia.com> (raw)
In-Reply-To: <20260120181819.GT961572@ziepe.ca>
On 20/01/2026 20:18, Jason Gunthorpe wrote:
> On Thu, Jan 08, 2026 at 01:11:15PM +0200, Edward Srouji wrote:
>> +static int phys_addr_to_bar(struct pci_dev *pdev, phys_addr_t pa)
>> +{
>> + resource_size_t start, end;
>> + int bar;
>> +
>> + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
>> + /* Skip BARs not present or not memory-mapped */
>> + if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM))
>> + continue;
>> +
>> + start = pci_resource_start(pdev, bar);
>> + end = pci_resource_end(pdev, bar);
>> +
>> + if (!start || !end)
>> + continue;
>> +
>> + if (pa >= start && pa <= end)
>> + return bar;
>> + }
>
> Don't we know which of the two BARs the mmap entry came from based on
> its type? This seems like overkill..
>
Actually no.
Currently, a given type can reside on different BARs based on function
type (i.e. PF/SF).
As we don't have any cap/knowledge for the above mapping, we would
prefer the above code which finds the correct bar (for now 0 or 2)
dynamically.
Yishai
prev parent reply other threads:[~2026-01-21 10:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 11:11 [PATCH rdma-next 0/2] RDMA: Add support for exporting dma-buf file descriptors Edward Srouji
2026-01-08 11:11 ` [PATCH rdma-next 1/2] RDMA/uverbs: Add DMABUF object type and operations Edward Srouji
2026-01-20 18:15 ` Jason Gunthorpe
2026-01-21 8:32 ` Leon Romanovsky
2026-01-21 13:56 ` Jason Gunthorpe
2026-01-21 16:27 ` Yishai Hadas
2026-01-21 10:07 ` Yishai Hadas
2026-01-25 14:31 ` Leon Romanovsky
2026-01-08 11:11 ` [PATCH rdma-next 2/2] RDMA/mlx5: Implement DMABUF export ops Edward Srouji
2026-01-20 18:18 ` Jason Gunthorpe
2026-01-21 10:35 ` Yishai Hadas [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=6a18009f-c9ea-4026-ac68-8cb753f4b001@nvidia.com \
--to=yishaih@nvidia.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edwards@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sumit.semwal@linaro.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