From: Atish Patra <atishp@atishpatra.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Atish Patra <atish.patra@wdc.com>,
devicetree <devicetree@vger.kernel.org>,
Albert Ou <aou@eecs.berkeley.edu>,
Tobias Klauser <tklauser@distanz.ch>,
Robin Murphy <robin.murphy@arm.com>,
"linux-kernel@vger.kernel.org List"
<linux-kernel@vger.kernel.org>, Rob Herring <robh+dt@kernel.org>,
iommu@lists.linux-foundation.org,
Guo Ren <guoren@linux.alibaba.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
linux-riscv <linux-riscv@lists.infradead.org>,
Frank Rowand <frowand.list@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [RFC 3/5] dma-mapping: Enable global non-coherent pool support for RISC-V
Date: Mon, 2 Aug 2021 11:22:42 -0700 [thread overview]
Message-ID: <CAOnJCUJgCHOR5nifNVjkQawKniGf81Zvsh226brdAPuLNkXAdQ@mail.gmail.com> (raw)
In-Reply-To: <20210727085244.GA20609@lst.de>
On Tue, Jul 27, 2021 at 1:52 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Mon, Jul 26, 2021 at 03:47:54PM -0700, Atish Patra wrote:
> > arch_dma_set_uncached works as well in this case. However, mips,
> > niops2 & xtensa uses a
> > fixed (via config) value for the offset. Similar approach can't be
> > used here because the platform specific
> > offset value has to be determined at runtime so that a single kernel
> > image can boot on all platforms.
>
> Nothing in the interface requires a fixed offset. And using the offset
> has one enormous advantage in that there is no need to declare a
> statically sized pool - allocations are fully dynamic. And any kind of
> fixed pool tends to cause huge problems.
>
> > 1. a new DT property so that arch specific code is aware of the
> > non-cacheable window offset.
>
> Yes.
>
> > individual device if a per-device non-cacheable
> > window support is required in future. As of now, the beagleV memory
>
> If you require a per-device noncachable area you can use the per-device
> coherent pools. But why would you want that?
>
> > region lies in 0x10_0000_00000 - x17_FFFF_FFFF
> > which is mapped to start of DRAM 0x80000000. All of the
> > non-coherent devices can do 32bit DMA only.
>
> Adjust ZONE_DMA32 so that it takes the uncached offset into account.
>
> > > > - mem = dma_init_coherent_memory(phys_addr, phys_addr, size, true);
> > > > + if (phys_addr == device_addr)
> > > > + mem = dma_init_coherent_memory(phys_addr, device_addr, size, true);
> > > > + else
> > > > + mem = dma_init_coherent_memory(phys_addr, device_addr, size, false);
> > >
> > > Nak. The phys_addr != device_addr support is goign away. This needs
> >
> > ok.
> >
> > > to be filled in using dma-ranges property hanging of the struct device.
> >
> > struct device is only accessible in rmem_dma_device_init. I couldn't
> > find a proper way to access it during
> > dma_reserved_default_memory setup under global pool.
> >
> > Does that mean we should use a per-device memory pool instead of a
> > global non-coherent pool ?
>
> Indeed, that would be a problem in this case. But if we can just
> use the uncached offset directly I think everything will be much
> simpler.
Yes. I was planning to change this to use an uncached offset.
However, the planned mass production for beaglev starlight sbc is
cancelled now [1].
As there is no other board that requires an uncached offset, I don't
think there is no usecase
for adding uncached offset support for RISC-V right now. I will
revisit(hopefully we don't have to)
this in case any platform implements uncached window support in future.
[1] https://www.cnx-software.com/2021/07/31/beaglev-starlight-sbc-wont-be-mass-manufactured-redesigned-beaglev-risc-v-sbc-expected-in-q1-2022/
--
Regards,
Atish
next prev parent reply other threads:[~2021-08-02 18:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-23 21:40 [RFC 0/5] Support non-coherent DMA on RISC-V using a global pool Atish Patra
2021-07-23 21:40 ` [RFC 1/5] RISC-V: Implement arch_sync_dma* functions Atish Patra
2021-07-26 6:56 ` Christoph Hellwig
2021-07-26 21:52 ` Atish Patra
2021-09-11 9:37 ` Guo Ren
2021-08-17 1:48 ` Guo Ren
2021-08-17 3:24 ` Atish Patra
2021-08-17 6:28 ` Guo Ren
2021-07-23 21:40 ` [RFC 2/5] of: Move of_dma_get_range to of_address.h Atish Patra
2021-07-23 21:40 ` [RFC 3/5] dma-mapping: Enable global non-coherent pool support for RISC-V Atish Patra
2021-07-25 22:29 ` Rob Herring
2021-07-26 7:00 ` Christoph Hellwig
2021-07-26 22:47 ` Atish Patra
2021-07-27 8:52 ` Christoph Hellwig
2021-08-02 18:22 ` Atish Patra [this message]
2021-07-23 21:40 ` [RFC 4/5] dma-direct: Allocate dma pages directly if global pool allocation fails Atish Patra
2021-07-26 7:01 ` Christoph Hellwig
2021-07-23 21:40 ` [RFC 5/5] RISC-V: Support a new config option for non-coherent DMA Atish Patra
2021-07-29 4:30 ` [RFC 0/5] Support non-coherent DMA on RISC-V using a global pool Palmer Dabbelt
2021-07-29 6:19 ` Atish Patra
2021-08-17 1:37 ` Guo Ren
2021-08-17 3:28 ` Atish Patra
2021-08-17 6:42 ` Guo Ren
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=CAOnJCUJgCHOR5nifNVjkQawKniGf81Zvsh226brdAPuLNkXAdQ@mail.gmail.com \
--to=atishp@atishpatra.org \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@wdc.com \
--cc=devicetree@vger.kernel.org \
--cc=dvyukov@google.com \
--cc=frowand.list@gmail.com \
--cc=guoren@linux.alibaba.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=tklauser@distanz.ch \
/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).