iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Sumit Garg <sumit.garg@linaro.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Daniel Thompson <daniel.thompson@linaro.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	obayashi.yoshimasa@socionext.com, stable <stable@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	iommu@lists.linux-foundation.org, robin.murphy@arm.com
Subject: Re: DMA direct mapping fix for 5.4 and earlier stable branches
Date: Tue, 9 Feb 2021 18:06:25 +0530	[thread overview]
Message-ID: <CAFA6WYO59w=wif8W16sG6BnzSjFhaY6PmRUTdSCu9A+zA7gzBw@mail.gmail.com> (raw)
In-Reply-To: <20210209093642.GA1006@lst.de>

Hi Christoph,

On Tue, 9 Feb 2021 at 15:06, Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Feb 09, 2021 at 10:23:12AM +0100, Greg KH wrote:
> > >   From the view point of ZeroCopy using DMABUF, is 5.4 not
> > > mature enough, and is 5.10 enough mature ?
> > >   This is the most important point for judging migration.
> >
> > How do you judge "mature"?
> >
> > And again, if a feature isn't present in a specific kernel version, why
> > would you think that it would be a viable solution for you to use?
>
> I'm pretty sure dma_get_sgtable has been around much longer and was
> supposed to work, but only really did work properly for arm32, and
> for platforms with coherent DMA.  I bet he is using non-coherent arm64,

It's an arm64 platform using coherent DMA where device coherent DMA
memory pool is defined in the DT as follows:

        reserved-memory {
                #address-cells = <2>;
                #size-cells = <2>;
                ranges;

                <snip>
                encbuffer: encbuffer@0xb0000000 {
                        compatible = "shared-dma-pool";
                        reg = <0 0xb0000000 0 0x08000000>; // this
area used with dma-coherent
                        no-map;
                };
                <snip>
        };

Device is dma-coherent as per following DT property:

                codec {
                        compatible = "socionext,uniphier-pxs3-codec";
                        <snip>
                        memory-region = <&encbuffer>;
                        dma-coherent;
                        <snip>
                };

And call chain to create device coherent DMA pool is as follows:

rmem_dma_device_init();
  dma_init_coherent_memory();
    memremap();
      ioremap_wc();

which simply maps coherent DMA memory into vmalloc space on arm64.

The thing I am unclear is why this is called a new feature rather than
a bug in dma_common_get_sgtable() which is failing to handle vmalloc
addresses? While at the same time DMA debug APIs specifically handle
vmalloc addresses [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/kernel/dma/debug.c?h=linux-5.4.y#n1462

-Sumit

> and it would be broken for other drivers there as well if people did
> test them, which they apparently so far did not.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-02-09 13:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  6:09 DMA direct mapping fix for 5.4 and earlier stable branches Sumit Garg
2021-02-09  6:58 ` Greg Kroah-Hartman
     [not found]   ` <CAFA6WYM+xJ0YDKenWFPMHrTz4gLWatnog84wyk31Xy2dTiT2RA@mail.gmail.com>
2021-02-09  8:04     ` Greg Kroah-Hartman
     [not found]       ` <27bbe35deacb4ca49f31307f4ed551b5@SOC-EX02V.e01.socionext.com>
2021-02-09  9:23         ` Greg KH
2021-02-09  9:36           ` Christoph Hellwig
2021-02-09 12:36             ` Sumit Garg [this message]
2021-02-09 12:45               ` Robin Murphy
2021-02-09 15:50                 ` Christoph Hellwig
2021-02-09 10:19           ` obayashi.yoshimasa
2021-02-09 10:39             ` Greg KH

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='CAFA6WYO59w=wif8W16sG6BnzSjFhaY6PmRUTdSCu9A+zA7gzBw@mail.gmail.com' \
    --to=sumit.garg@linaro.org \
    --cc=daniel.thompson@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=obayashi.yoshimasa@socionext.com \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.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).