All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Greg Ungerer <gregungerer@westnet.com.au>
Cc: Christoph Hellwig <hch@lst.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Linux IOMMU <iommu@lists.linux-foundation.org>,
	Michal Simek <monstr@monstr.eu>,
	ashutosh.dixit@intel.com, alpha <linux-alpha@vger.kernel.org>,
	arcml <linux-snps-arc@lists.infradead.org>,
	linux-c6x-dev@linux-c6x.org,
	linux-m68k <linux-m68k@lists.linux-m68k.org>,
	Openrisc <openrisc@lists.librecores.org>,
	Parisc List <linux-parisc@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	sparclinux <sparclinux@vger.kernel.org>,
	linux-xtensa@linux-xtensa.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [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?

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Greg Ungerer <gregungerer@westnet.com.au>
Cc: Christoph Hellwig <hch@lst.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Linux IOMMU <iommu@lists.linux-foundation.org>,
	Michal Simek <monstr@monstr.eu>,
	ashutosh.dixit@intel.com, alpha <linux-alpha@vger.kernel.org>,
	arcml <linux-snps-arc@lists.infradead.org>,
	linux-c6x-dev@linux-c6x.org,
	linux-m68k <linux-m68k@lists.linux-m68k.org>,
	Openrisc <openrisc@lists.librecores.org>,
	Parisc List <linux-parisc@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	sparclinux <sparclinux@vger.kernel.org>,
	linux-xtensa@linux-xtensa.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*
Date: Mon, 17 Dec 2018 11:59:31 +0000	[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?

WARNING: multiple messages have this Message-ID (diff)
From: hch@lst.de (Christoph Hellwig)
To: linux-snps-arc@lists.infradead.org
Subject: [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@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?

WARNING: multiple messages have this Message-ID (diff)
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: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  8:25 ensure dma_alloc_coherent always returns zeroed memory Christoph Hellwig
2018-12-14  8:25 ` [OpenRISC] " Christoph Hellwig
2018-12-14  8:25 ` Christoph Hellwig
2018-12-14  8:25 ` Christoph Hellwig
2018-12-14  8:25 ` Christoph Hellwig
2018-12-14  8:25 ` [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* Christoph Hellwig
2018-12-14  8:25   ` [OpenRISC] " Christoph Hellwig
2018-12-14  8:25   ` Christoph Hellwig
2018-12-14  8:25   ` Christoph Hellwig
2018-12-14  8:25   ` Christoph Hellwig
2018-12-14  9:54   ` Geert Uytterhoeven
2018-12-14  9:54     ` [OpenRISC] " Geert Uytterhoeven
2018-12-14  9:54     ` Geert Uytterhoeven
2018-12-14  9:54     ` Geert Uytterhoeven
2018-12-14  9:54     ` Geert Uytterhoeven
2018-12-14  9:55     ` Geert Uytterhoeven
2018-12-14  9:55       ` [OpenRISC] " Geert Uytterhoeven
2018-12-14  9:55       ` Geert Uytterhoeven
2018-12-14  9:55       ` Geert Uytterhoeven
2018-12-14  9:55       ` Geert Uytterhoeven
2018-12-14 11:47     ` Christoph Hellwig
2018-12-14 11:47       ` [OpenRISC] " Christoph Hellwig
2018-12-14 11:47       ` Christoph Hellwig
2018-12-14 11:47       ` Christoph Hellwig
2018-12-14 11:47       ` Christoph Hellwig
2018-12-14 12:36       ` Geert Uytterhoeven
2018-12-14 12:36         ` [OpenRISC] " Geert Uytterhoeven
2018-12-14 12:36         ` Geert Uytterhoeven
2018-12-14 12:36         ` Geert Uytterhoeven
2018-12-14 14:14       ` Greg Ungerer
2018-12-14 14:14         ` [OpenRISC] " Greg Ungerer
2018-12-14 14:14         ` Greg Ungerer
2018-12-14 14:14         ` Greg Ungerer
2018-12-14 14:14         ` Greg Ungerer
2018-12-14 14:14         ` Greg Ungerer
2018-12-17 11:59         ` Christoph Hellwig [this message]
2018-12-17 11:59           ` [OpenRISC] " Christoph Hellwig
2018-12-17 11:59           ` Christoph Hellwig
2018-12-17 11:59           ` Christoph Hellwig
2019-01-11  6:09           ` Greg Ungerer
2018-12-14 12:12   ` Eugeniy Paltsev
2018-12-14 12:12     ` [OpenRISC] " Eugeniy Paltsev
2018-12-14 12:12     ` Eugeniy Paltsev
2018-12-14 12:12     ` Eugeniy Paltsev
2018-12-14 12:12     ` Eugeniy Paltsev
2018-12-14 12:21     ` hch
2018-12-14 12:21       ` [OpenRISC] " hch
2018-12-14 12:21       ` hch-jcswGhMUV9g
2018-12-14 12:21       ` hch
2018-12-14 12:21       ` hch
2018-12-14 18:10   ` Sam Ravnborg
2018-12-14 18:10     ` [OpenRISC] " Sam Ravnborg
2018-12-14 18:10     ` Sam Ravnborg
2018-12-14 18:10     ` Sam Ravnborg
2018-12-14 18:35     ` Christoph Hellwig
2018-12-14 18:35       ` [OpenRISC] " Christoph Hellwig
2018-12-14 18:35       ` Christoph Hellwig
2018-12-14 18:35       ` Christoph Hellwig
2018-12-14  8:25 ` [PATCH 2/2] dma-mapping: deprecate dma_zalloc_coherent Christoph Hellwig
2018-12-14  8:25   ` [OpenRISC] " Christoph Hellwig
2018-12-14  8:25   ` Christoph Hellwig
2018-12-14  8:25   ` Christoph Hellwig
2018-12-14  8:25   ` Christoph Hellwig
2018-12-14 13:33 ` ensure dma_alloc_coherent always returns zeroed memory Christoph Hellwig
2018-12-14 13:33   ` [OpenRISC] " Christoph Hellwig
2018-12-14 13:33   ` Christoph Hellwig
2018-12-14 13:33   ` Christoph Hellwig
2018-12-19 16:59 ` Christoph Hellwig
2018-12-19 16:59   ` [OpenRISC] " Christoph Hellwig
2018-12-19 16:59   ` Christoph Hellwig
2018-12-19 16:59   ` Christoph Hellwig
2018-12-20 14:32   ` Eugeniy Paltsev
2018-12-20 14:32     ` Eugeniy Paltsev
2018-12-20 14:32     ` Eugeniy Paltsev
2018-12-20 14:32     ` Eugeniy Paltsev
2018-12-20 14:34     ` hch
2018-12-20 14:34       ` [OpenRISC] " hch
2018-12-20 14:34       ` hch
2018-12-20 14:34       ` hch
2018-12-20 14:34       ` hch
2018-12-20 14:39       ` Eugeniy Paltsev
2018-12-20 14:39         ` Eugeniy Paltsev
2018-12-20 14:39         ` Eugeniy Paltsev
2018-12-20 14:39         ` Eugeniy Paltsev
2018-12-20 14:46         ` hch
2018-12-20 14:46           ` [OpenRISC] " hch
2018-12-20 14:46           ` hch
2018-12-20 14:46           ` hch
2018-12-20 14:46           ` hch
2018-12-20 17:37           ` hch
2018-12-20 17:37             ` [OpenRISC] " hch
2018-12-20 17:37             ` hch
2018-12-20 17:37             ` 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=ashutosh.dixit@intel.com \
    --cc=geert@linux-m68k.org \
    --cc=gregungerer@westnet.com.au \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-c6x-dev@linux-c6x.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=monstr@monstr.eu \
    --cc=openrisc@lists.librecores.org \
    --cc=sparclinux@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 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.