public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-arch@vger.kernel.org, linux-alpha@vger.kernel.org,
	linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>,
	joro@8bytes.org, the arch/x86 maintainers <x86@kernel.org>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	iommu@lists.linux-foundation.org, jdmason@kudzu.us,
	xen-devel@lists.xenproject.org, robin.murphy@arm.com,
	linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com
Subject: Re: remove the ->mapping_error method from dma_map_ops V2
Date: Thu, 22 Nov 2018 17:07:15 +0000	[thread overview]
Message-ID: <20181122170715.GI30658@n2100.armlinux.org.uk> (raw)
In-Reply-To: <CAHk-=wh=_T=A53+o4zLNbKio43LGqVDb0KCbWPDvAg54bRDmWw@mail.gmail.com>

On Thu, Nov 22, 2018 at 08:50:47AM -0800, Linus Torvalds wrote:
> On Thu, Nov 22, 2018 at 6:03 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > The 0 return doesn't work for direct mappings that have ram at address
> > zero and a lot of IOMMUs that start allocating bus space from address
> > zero, so we can't consolidate on that, but I think we can move everyone
> > to all-Fs, which the patch here does.
> 
> Hmm. Maybe not limit it to just all ones, but actually use the
> (standard, for the kernel) IS_ERR_VALUE()?
> 
> That basically reserves the last 4095 values in an unsigned long for
> error values.
> 
> Then those functions could actually return *what* error they
> encountered, using just plain
> 
>         return -ENOMEM;
> 
> or whatever?

Linus,

I'm afraid that won't work very well - 32 bit platforms with 64-bit
addresses (LPAE) would have dma_addr_t as a 64-bit value, which
wouldn't fit into an unsigned long.

IS_ERR_VALUE() would cast a 64-bit DMA address down to a 32-bit
pointer (effectively masking with 0xffffffff).  It would have the
effect of making (eg) 0xXXXXXXXX_fffffVVV an error, where XXXXXXXX
are any of the top 32-bits of a 64-bit bus address, and VVV is the
error code value.

That could be a problem if you hit it in several places throughout
your available RAM... we'd have to mark every top page of RAM in
a naturally aligned 4GB as unusable, as well as block the top page
in natually aligned 4GB blocks from IOMMUs... and then what about
buses that have weird offsets...

So, I don't think the IS_ERR_VALUE() would work very well.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

  parent reply	other threads:[~2018-11-22 17:07 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-22 14:02 remove the ->mapping_error method from dma_map_ops V2 Christoph Hellwig
2018-11-22 14:02 ` Christoph Hellwig
     [not found] ` <20181122140320.24080-1-hch-jcswGhMUV9g@public.gmane.org>
2018-11-22 14:02   ` [PATCH 01/24] dma-direct: Make DIRECT_MAPPING_ERROR viable for SWIOTLB Christoph Hellwig
2018-11-22 14:02     ` Christoph Hellwig
2018-11-22 14:02   ` [PATCH 02/24] swiotlb: Skip cache maintenance on map error Christoph Hellwig
2018-11-22 14:02     ` Christoph Hellwig
2018-11-22 14:02 ` [PATCH 03/24] dma-mapping: provide a generic DMA_MAPPING_ERROR Christoph Hellwig
2018-11-22 14:02   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 04/24] dma-direct: remove the mapping_error dma_map_ops method Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 05/24] arm: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 06/24] powerpc/iommu: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 07/24] mips/jazz: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 08/24] s390: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 09/24] sparc: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 10/24] parisc/ccio: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 11/24] parisc/sba_iommu: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 12/24] arm64: remove the dummy_dma_ops mapping_error method Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 13/24] alpha: remove the mapping_error dma_map_ops method Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 14/24] ia64/sba_iommu: improve internal map_page users Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 15/24] ia64/sba_iommu: remove the mapping_error dma_map_ops method Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 16/24] ia64/sn: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 17/24] x86/amd_gart: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 18/24] x86/calgary: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 19/24] iommu: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 20/24] iommu/intel: small map_page cleanup Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 21/24] iommu/vt-d: remove the mapping_error dma_map_ops method Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 22/24] iommu/dma-iommu: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 23/24] xen-swiotlb: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 14:03 ` [PATCH 24/24] dma-mapping: " Christoph Hellwig
2018-11-22 14:03   ` Christoph Hellwig
2018-11-22 16:50 ` remove the ->mapping_error method from dma_map_ops V2 Linus Torvalds
2018-11-22 16:50   ` Linus Torvalds
2018-11-22 17:07   ` Russell King - ARM Linux [this message]
2018-11-22 17:07     ` Russell King - ARM Linux
     [not found]     ` <20181122170715.GI30658-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-11-22 17:09       ` Linus Torvalds
2018-11-22 17:09         ` Linus Torvalds
2018-11-22 17:14         ` Russell King - ARM Linux
2018-11-22 17:14           ` Russell King - ARM Linux
2018-11-22 17:52         ` Robin Murphy
2018-11-22 17:52           ` Robin Murphy
     [not found]           ` <11829e3c-7302-f821-cf5c-863e5267a17b-5wv7dgnIgG8@public.gmane.org>
2018-11-22 17:55             ` Linus Torvalds
2018-11-22 17:55               ` Linus Torvalds
2018-11-22 18:05               ` Russell King - ARM Linux
2018-11-22 18:05                 ` Russell King - ARM Linux
     [not found]                 ` <20181122180526.GL30658-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-11-23  6:57                   ` Christoph Hellwig
2018-11-23  6:57                     ` Christoph Hellwig
     [not found]               ` <CAHk-=whxf0zqutExPr_j1A625Z3gcL6k_ABzKo1BtzN4F93hkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-23  6:55                 ` Christoph Hellwig
2018-11-23  6:55                   ` Christoph Hellwig
2018-11-28  7:41                   ` Christoph Hellwig
2018-11-28  7:41                     ` Christoph Hellwig
     [not found]                     ` <20181128074117.GA21126-jcswGhMUV9g@public.gmane.org>
2018-11-28 16:47                       ` Linus Torvalds
2018-11-28 16:47                         ` Linus Torvalds
2018-11-28 17:45                         ` Russell King - ARM Linux
2018-11-28 17:45                           ` Russell King - ARM Linux
2018-11-28 18:00                           ` Linus Torvalds
2018-11-28 18:00                             ` Linus Torvalds
2018-11-28 18:08                             ` Russell King - ARM Linux
2018-11-28 18:08                               ` Russell King - ARM Linux
     [not found]                               ` <20181128180841.GM30658-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-11-28 19:19                                 ` Linus Torvalds
2018-11-28 19:31                                   ` Russell King - ARM Linux
2018-11-28 19:31                                     ` Russell King - ARM Linux
2018-11-29 16:23                                   ` Christoph Hellwig
2018-11-29 16:23                                     ` Christoph Hellwig
2018-11-29 17:44                                     ` Linus Torvalds
2018-11-29 17:44                                       ` Linus Torvalds
2018-11-29 18:31                                       ` Christoph Hellwig
2018-11-29 18:31                                         ` Christoph Hellwig
2018-11-29 18:53                                         ` Linus Torvalds
2018-11-29 18:53                                           ` Linus Torvalds
2018-11-29 18:55                                           ` Christoph Hellwig
2018-11-29 18:55                                             ` Christoph Hellwig
2018-11-28 19:23                               ` Russell King - ARM Linux
2018-11-28 19:23                                 ` Russell King - ARM Linux
2018-11-28 19:27                             ` David Miller
2018-11-28 19:27                               ` David Miller
2018-11-28 19:47                               ` Russell King - ARM Linux
2018-11-28 19:47                                 ` Russell King - ARM Linux
     [not found]                                 ` <20181128194708.GP30658-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-11-28 23:01                                   ` Shuah Khan
2018-11-28 23:01                                     ` Shuah Khan
2018-11-23 10:49           ` Joerg Roedel
2018-11-23 10:49             ` Joerg Roedel
2018-11-23 11:01             ` Russell King - ARM Linux
2018-11-23 11:01               ` Russell King - ARM Linux
2018-11-23 13:03               ` Joerg Roedel
2018-11-23 13:03                 ` Joerg Roedel
2018-11-23 13:20                 ` Russell King - ARM Linux
2018-11-23 13:20                   ` Russell King - ARM Linux

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=20181122170715.GI30658@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=dwmw2@infradead.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jdmason@kudzu.us \
    --cc=joro@8bytes.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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