linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Baruch Siach <baruch@tkos.co.il>
Cc: "Christoph Hellwig" <hch@lst.de>,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Robin Murphy" <robin.murphy@arm.com>,
	"Will Deacon" <will@kernel.org>,
	iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	"Petr Tesařík" <petr@tesarici.cz>,
	"Ramon Fried" <ramon@neureality.ai>,
	"Elad Nachman" <enachman@marvell.com>
Subject: Re: [PATCH] arm64: mm: fix DMA zone when dma-ranges is missing
Date: Tue, 27 Aug 2024 13:11:42 +0300	[thread overview]
Message-ID: <Zs2mXlPtTftIqXhm@arm.com> (raw)
In-Reply-To: <731d204f5f556ad61bbaf004b1d984f83c90b4f5.1724748249.git.baruch@tkos.co.il>

On Tue, Aug 27, 2024 at 11:44:09AM +0300, Baruch Siach wrote:
> Some platforms, like Rockchip RK3568 based Odroid M1, do not provide DMA
> limits information in device-tree dma-ranges property. Still some device
> drivers set DMA limit that relies on DMA zone at low 4GB memory area.
> Until commit ba0fb44aed47 ("dma-mapping: replace zone_dma_bits by
> zone_dma_limit"), zone_sizes_init() restricted DMA zone to low 32-bit
> when there is RAM there.
> 
> Restore DMA zone 32-bit limit for platforms that have RAM in this area.
> 
> Fixes: ba0fb44aed47 ("dma-mapping: replace zone_dma_bits by zone_dma_limit")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> This should go via the dma-mapping tree that contains the fixed commit.
> ---
>  arch/arm64/mm/init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index bfb10969cbf0..7fcd0aaa9bb6 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -116,6 +116,9 @@ static void __init arch_reserve_crashkernel(void)
>  
>  static phys_addr_t __init max_zone_phys(phys_addr_t zone_limit)
>  {
> +	if (memblock_start_of_DRAM() < U32_MAX)
> +		zone_limit = min(zone_limit, U32_MAX);
> +
>  	return min(zone_limit, memblock_end_of_DRAM() - 1) + 1;
>  }

Thanks both Baruch and Marek for digging into this and finding a
solution.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


  reply	other threads:[~2024-08-27 10:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  8:44 [PATCH] arm64: mm: fix DMA zone when dma-ranges is missing Baruch Siach
2024-08-27 10:11 ` Catalin Marinas [this message]
2024-08-27 10:22 ` Robin Murphy
2024-08-28  4:14   ` Baruch Siach

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=Zs2mXlPtTftIqXhm@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=baruch@tkos.co.il \
    --cc=enachman@marvell.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=petr@tesarici.cz \
    --cc=ramon@neureality.ai \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).