public inbox for openrisc@lists.librecores.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*
Date: Mon, 17 Dec 2018 12:59:31 +0100	[thread overview]
Message-ID: <20181217115931.GA6853@lst.de> (raw)
In-Reply-To: <5ae55118-6858-9121-6b3e-9b19b41550ef@westnet.com.au>

On Sat, Dec 15, 2018 at 12:14:29AM +1000, Greg Ungerer wrote:
> Yep, that is right. Certainly the MMU case is broken. Some noMMU cases work
> by virtue of the SoC only having an instruction cache (the older V2 cores).

Is there a good an easy case to detect if a core has a cache?  Either
runtime or in Kconfig?

> The MMU case is fixable, but I think it will mean changing away from
> the fall-back virtual:physical 1:1 mapping it uses for the kernel address
> space. So not completely trivial. Either that or a dedicated area of RAM
> for coherent allocations that we can mark as non-cachable via the really
> course grained and limited ACR registers - not really very appealing.

What about CF_PAGE_NOCACHE?  Reading arch/m68k/include/asm/mcf_pgtable.h
suggest this would cause an uncached mapping, in which case something
like this should work:

	http://git.infradead.org/users/hch/misc.git/commitdiff/4b8711d436e8d56edbc5ca19aa2be639705bbfef

> The noMMU case in general is probably limited to something like that same
> type of dedicated RAM/ACR register mechamism.
>
> The most commonly used periperal with DMA is the FEC ethernet module,
> and it has some "special" (used very loosely) cache flushing for
> parts like the 532x family which probably makes it mostly work right.
> There is a PCI bus on the 54xx family of parts, and I know general
> ethernet cards on it (like e1000's) have problems I am sure are
> related to the fact that coherent memory allocations aren't.

If we really just care about FEC we can just switch it do use
DMA_ATTR_NON_CONSISTENT and do explicit cache flushing.  But as far
as I can tell FEC only uses DMA coherent allocations for the TSO
headers anyway, is TSO even used on this SOC?

  reply	other threads:[~2018-12-17 11:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  8:25 [OpenRISC] ensure dma_alloc_coherent always returns zeroed memory Christoph Hellwig
2018-12-14  8:25 ` [OpenRISC] [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* Christoph Hellwig
2018-12-14  9:54   ` Geert Uytterhoeven
2018-12-14  9:55     ` Geert Uytterhoeven
2018-12-14 11:47     ` Christoph Hellwig
2018-12-14 12:36       ` Geert Uytterhoeven
2018-12-14 14:14       ` Greg Ungerer
2018-12-17 11:59         ` Christoph Hellwig [this message]
2018-12-14 12:12   ` Eugeniy Paltsev
2018-12-14 12:21     ` hch
2018-12-14 18:10   ` Sam Ravnborg
2018-12-14 18:35     ` Christoph Hellwig
2018-12-14  8:25 ` [OpenRISC] [PATCH 2/2] dma-mapping: deprecate dma_zalloc_coherent Christoph Hellwig
2018-12-14 13:33 ` [OpenRISC] ensure dma_alloc_coherent always returns zeroed memory Christoph Hellwig
2018-12-19 16:59 ` Christoph Hellwig
     [not found]   ` <1545316369.14089.20.camel@synopsys.com>
2018-12-20 14:34     ` hch
     [not found]       ` <1545316759.14089.22.camel@synopsys.com>
2018-12-20 14:46         ` hch
2018-12-20 17:37           ` hch

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=20181217115931.GA6853@lst.de \
    --to=hch@lst.de \
    --cc=openrisc@lists.librecores.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