linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>, Christoph Hellwig <hch@lst.de>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	robin.murphy@arm.com,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	palmer@dabbelt.com, paul.walmsley@sifive.com,
	linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
	m.szyprowski@samsung.com
Subject: Re: [PATCH v2 5/5] of: address: Always use dma_default_coherent for default coherency
Date: Fri, 03 Mar 2023 11:11:56 +1100	[thread overview]
Message-ID: <87356mlmlv.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <B43602D1-89D4-465F-83B1-CD106E07CB29@flygoat.com>

Jiaxun Yang <jiaxun.yang@flygoat.com> writes:
>> 2023年3月1日 13:06,Christoph Hellwig <hch@lst.de> 写道:
>> 
>>> - select OF_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE
>> 
>> Doesn't powerpc need to select CONFIG_ARCH_DMA_DEFAULT_COHERENT now,
>> or even better should be doing that in the patch adding that
>> symbol?
>
> If I read the code correctly for powerpc OF_DMA_DEFAULT_COHERENT is only selected
> with !NOT_COHERENT_CACHE, which means non-coherent dma support is disabled….

I think you're right, but it's not easy to understand.

powerpc's NOT_COHERENT_CACHE selects:

  select ARCH_HAS_DMA_PREP_COHERENT
  select ARCH_HAS_SYNC_DMA_FOR_DEVICE
  select ARCH_HAS_SYNC_DMA_FOR_CPU


Then in your patch 3 you do:

 #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
	defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
	defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
-bool dma_default_coherent;
+bool dma_default_coherent = IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT);
 #endif

So for powerpc if NOT_COHERENT_CACHE=n, then none of those ARCH_HAS
symbols are defined, and so CONFIG_ARCH_DMA_DEFAULT_COHERENT is never used.

But like I said it's not very obvious, and it also seems fragile to
future changes.

So it seems it would be more future proof, and self documenting for
powerpc to just have:

        select ARCH_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE


cheers

      reply	other threads:[~2023-03-03  0:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 11:36 [PATCH v2 0/5] Use dma_default_coherent for devicetree default coherency Jiaxun Yang
2023-02-23 11:36 ` [PATCH v2 1/5] of: address: Fix default coherency for MIPS Jiaxun Yang
2023-02-23 11:36 ` [PATCH v2 2/5] dma-mapping: Provide a fallback dma_default_coherent Jiaxun Yang
2023-03-01 13:03   ` Christoph Hellwig
2023-02-23 11:36 ` [PATCH v2 3/5] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT Jiaxun Yang
2023-03-01 13:03   ` Christoph Hellwig
2023-02-23 11:36 ` [PATCH v2 4/5] riscv: Select ARCH_DMA_DEFAULT_COHERENT Jiaxun Yang
2023-02-23 22:20   ` Conor Dooley
2023-03-15  2:07     ` Palmer Dabbelt
2023-02-23 11:36 ` [PATCH v2 5/5] of: address: Always use dma_default_coherent for default coherency Jiaxun Yang
2023-03-01 13:06   ` Christoph Hellwig
2023-03-01 14:18     ` Jiaxun Yang
2023-03-03  0:11       ` Michael Ellerman [this message]

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=87356mlmlv.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=hch@lst.de \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=m.szyprowski@samsung.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=tsbogend@alpha.franken.de \
    /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).