From: Dave Jiang <dave.jiang@intel.com>
To: Leon Romanovsky <leon@kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>, Jon Mason <jdmason@kudzu.us>,
Allen Hubbe <allenbh@gmail.com>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, ntb@lists.linux.dev
Subject: Re: [PATCH v2 1/6] ntb: Store original DMA address for future release
Date: Fri, 1 May 2026 10:00:10 -0700 [thread overview]
Message-ID: <8f751a3e-0fd8-4a61-8955-027213a7bd1e@intel.com> (raw)
In-Reply-To: <20260501-dma-attrs-debug-v2-1-8dbac75cd501@nvidia.com>
On 4/30/26 11:35 PM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> The DMA API requires that dma_free_attrs receive the exact dma_handle
> originally returned by the allocation function. Do not modify it.
>
> Fixes: fc5d1829f9bf ("NTB: transport: Try harder to alloc an aligned MW buffer")
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/ntb/ntb_transport.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 7cabc82305d6b..771eb7d9f4356 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -223,6 +223,7 @@ struct ntb_transport_mw {
> void *alloc_addr;
> void *virt_addr;
> dma_addr_t dma_addr;
> + dma_addr_t original_dma_addr;
> };
>
> struct ntb_transport_client_dev {
> @@ -766,7 +767,7 @@ static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw)
>
> ntb_mw_clear_trans(nt->ndev, PIDX, num_mw);
> dma_free_coherent(dma_dev, mw->alloc_size,
> - mw->alloc_addr, mw->dma_addr);
> + mw->alloc_addr, mw->original_dma_addr);
> mw->xlat_size = 0;
> mw->buff_size = 0;
> mw->alloc_size = 0;
> @@ -802,6 +803,7 @@ static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw,
> return -ENOMEM;
> }
> virt_addr = alloc_addr;
> + mw->original_dma_addr = dma_addr;
>
> /*
> * we must ensure that the memory address allocated is BAR size
>
next prev parent reply other threads:[~2026-05-01 17:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 6:35 [PATCH v2 0/6] Add DMA attributes tracking Leon Romanovsky
2026-05-01 6:35 ` [PATCH v2 1/6] ntb: Store original DMA address for future release Leon Romanovsky
2026-05-01 17:00 ` Dave Jiang [this message]
2026-05-01 6:35 ` [PATCH v2 2/6] ntb: Use consistent DMA attributes when freeing DMA mappings Leon Romanovsky
2026-05-01 17:00 ` Dave Jiang
2026-05-01 6:35 ` [PATCH v2 3/6] dma-debug: Remove unused DMA attribute parameter Leon Romanovsky
2026-05-01 6:35 ` [PATCH v2 4/6] dma-debug: Record DMA attributes in debug entry Leon Romanovsky
2026-05-01 6:35 ` [PATCH v2 5/6] dma-debug: Feed DMA attribute for unmapping flows too Leon Romanovsky
2026-05-01 6:35 ` [PATCH v2 6/6] dma-debug: Ensure mappings are created and released with matching attributes Leon Romanovsky
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=8f751a3e-0fd8-4a61-8955-027213a7bd1e@intel.com \
--to=dave.jiang@intel.com \
--cc=allenbh@gmail.com \
--cc=iommu@lists.linux.dev \
--cc=jdmason@kudzu.us \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=ntb@lists.linux.dev \
--cc=robin.murphy@arm.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