mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: chalianis1@gmail.com, Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH RFT 1/2] ARM: mmu: take DMA offset into account for coherent memory
Date: Mon,  1 Dec 2025 22:18:53 +0100	[thread overview]
Message-ID: <20251201211911.1402617-1-a.fatoum@barebox.org> (raw)

Now that dma_alloc_coherent and dma_alloc_writecombine take an optional
device parameter, let's take the dma_offset of the device into account
if a device has been supplied.

This will allow supporting systems, where the CPU and other DMA masters,
see the SDRAM at different addresses (i.e. has a dma-ranges in the DT).

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
Result of a discussion with Anis. Needs to be tested.
---
 arch/arm/cpu/mmu-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/mmu-common.c b/arch/arm/cpu/mmu-common.c
index dd4c8f7de7d4..30a9dfbcb9c0 100644
--- a/arch/arm/cpu/mmu-common.c
+++ b/arch/arm/cpu/mmu-common.c
@@ -47,7 +47,7 @@ void *dma_alloc_map(struct device *dev,
 	size = PAGE_ALIGN(size);
 	ret = xmemalign(PAGE_SIZE, size);
 	if (dma_handle)
-		*dma_handle = (dma_addr_t)ret;
+		*dma_handle = cpu_to_dma(ret);
 
 	memset(ret, 0, size);
 	dma_flush_range(ret, size);
-- 
2.47.3




             reply	other threads:[~2025-12-01 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 21:18 Ahmad Fatoum [this message]
2025-12-01 21:18 ` [PATCH RFT 2/2] usb: xhci: pass hardware device to dma_alloc_coherent Ahmad Fatoum

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=20251201211911.1402617-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    --cc=chalianis1@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