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>,
"Rob Herring" <robh+dt@kernel.org>,
"Frank Rowand" <frowand.list@gmail.com>,
"Will Deacon" <will@kernel.org>,
"Robin Murphy" <robin.murphy@arm.com>,
iommu@lists.linux.dev, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, "Petr Tesařík" <petr@tesarici.cz>,
"Ramon Fried" <ramon@neureality.ai>,
"Elad Nachman" <enachman@marvell.com>
Subject: Re: [PATCH RFC 3/4] dma-direct: add offset to zone_dma_bits
Date: Tue, 9 Jan 2024 10:54:59 +0000 [thread overview]
Message-ID: <ZZ0mAxGupZKRPzWR@arm.com> (raw)
In-Reply-To: <87msterf7b.fsf@tarshish>
On Tue, Jan 09, 2024 at 12:03:43PM +0200, Baruch Siach wrote:
> On Mon, Jan 08 2024, Catalin Marinas wrote:
> > On Wed, Dec 27, 2023 at 05:04:27PM +0200, Baruch Siach wrote:
> >> Current code using zone_dma_bits assume that all addresses range in the
> >> bits mask are suitable for DMA. For some existing platforms this
> >> assumption is not correct. DMA range might have non zero lower limit.
> >>
> >> Add 'zone_dma_off' for platform code to set base address for DMA zone.
> >>
> >> Rename the dma_direct_supported() local 'min_mask' variable to better
> >> describe its use as limit.
> >>
> >> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> >
> > When I suggested taking the DMA offsets into account, that's not exactly
> > what I meant. Based on patch 4, it looks like zone_dma_off is equivalent
> > to the lower CPU address. Let's say a system has DRAM starting at 2GB
> > and all 32-bit DMA-capable devices has a DMA offset of 0. We want
> > ZONE_DMA32 to end at 4GB rather than 6GB.
>
> Patch 4 sets zone_dma_off to the lower limit from 'dma-ranges' property
> that determines zone_dma_bits. This is not necessarily equivalent to
> start of DRAM, though it happens to be that way on my platform.
A bit better but it still assumes that all devices have the same DMA
offset which may not be the case.
--
Catalin
WARNING: multiple messages have this Message-ID (diff)
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>,
"Rob Herring" <robh+dt@kernel.org>,
"Frank Rowand" <frowand.list@gmail.com>,
"Will Deacon" <will@kernel.org>,
"Robin Murphy" <robin.murphy@arm.com>,
iommu@lists.linux.dev, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, "Petr Tesařík" <petr@tesarici.cz>,
"Ramon Fried" <ramon@neureality.ai>,
"Elad Nachman" <enachman@marvell.com>
Subject: Re: [PATCH RFC 3/4] dma-direct: add offset to zone_dma_bits
Date: Tue, 9 Jan 2024 10:54:59 +0000 [thread overview]
Message-ID: <ZZ0mAxGupZKRPzWR@arm.com> (raw)
In-Reply-To: <87msterf7b.fsf@tarshish>
On Tue, Jan 09, 2024 at 12:03:43PM +0200, Baruch Siach wrote:
> On Mon, Jan 08 2024, Catalin Marinas wrote:
> > On Wed, Dec 27, 2023 at 05:04:27PM +0200, Baruch Siach wrote:
> >> Current code using zone_dma_bits assume that all addresses range in the
> >> bits mask are suitable for DMA. For some existing platforms this
> >> assumption is not correct. DMA range might have non zero lower limit.
> >>
> >> Add 'zone_dma_off' for platform code to set base address for DMA zone.
> >>
> >> Rename the dma_direct_supported() local 'min_mask' variable to better
> >> describe its use as limit.
> >>
> >> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> >
> > When I suggested taking the DMA offsets into account, that's not exactly
> > what I meant. Based on patch 4, it looks like zone_dma_off is equivalent
> > to the lower CPU address. Let's say a system has DRAM starting at 2GB
> > and all 32-bit DMA-capable devices has a DMA offset of 0. We want
> > ZONE_DMA32 to end at 4GB rather than 6GB.
>
> Patch 4 sets zone_dma_off to the lower limit from 'dma-ranges' property
> that determines zone_dma_bits. This is not necessarily equivalent to
> start of DRAM, though it happens to be that way on my platform.
A bit better but it still assumes that all devices have the same DMA
offset which may not be the case.
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-01-09 10:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-27 15:04 [PATCH RFC 0/4] arm64: support DMA zone starting above 4GB Baruch Siach
2023-12-27 15:04 ` Baruch Siach
2023-12-27 15:04 ` [PATCH RFC 1/4] of: get dma area lower limit Baruch Siach
2023-12-27 15:04 ` Baruch Siach
2024-01-17 22:23 ` Christoph Lameter (Ampere)
2024-01-17 22:23 ` Christoph Lameter (Ampere)
2024-01-18 10:59 ` Baruch Siach
2024-01-18 10:59 ` Baruch Siach
2023-12-27 15:04 ` [PATCH RFC 2/4] of: unittest: add test for of_dma_get_cpu_limits() 'min' param Baruch Siach
2023-12-27 15:04 ` Baruch Siach
2023-12-27 15:04 ` [PATCH RFC 3/4] dma-direct: add offset to zone_dma_bits Baruch Siach
2023-12-27 15:04 ` Baruch Siach
2024-01-08 17:55 ` Catalin Marinas
2024-01-08 17:55 ` Catalin Marinas
2024-01-09 10:03 ` Baruch Siach
2024-01-09 10:03 ` Baruch Siach
2024-01-09 10:54 ` Catalin Marinas [this message]
2024-01-09 10:54 ` Catalin Marinas
2024-01-09 13:54 ` Baruch Siach
2024-01-09 13:54 ` Baruch Siach
2024-01-09 17:51 ` Catalin Marinas
2024-01-09 17:51 ` Catalin Marinas
2023-12-27 15:04 ` [PATCH RFC 4/4] arm64: mm: take DMA zone offset into account Baruch Siach
2023-12-27 15:04 ` 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=ZZ0mAxGupZKRPzWR@arm.com \
--to=catalin.marinas@arm.com \
--cc=baruch@tkos.co.il \
--cc=devicetree@vger.kernel.org \
--cc=enachman@marvell.com \
--cc=frowand.list@gmail.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=petr@tesarici.cz \
--cc=ramon@neureality.ai \
--cc=robh+dt@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.