Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1555525

Re: [PATCH v2] arm64: do not set dma masks that device connection can't handle

From Christoph Hellwig <hch@lst.de>
Newsgroups linux.kernel
Subject Re: [PATCH v2] arm64: do not set dma masks that device connection can't handle
Date 2017-01-10 16:00 +0100
Message-ID <sY641-2Dh-11@gated-at.bofh.it> (permalink)
References <sXCIG-19v-5@gated-at.bofh.it> <sY3fP-R8-23@gated-at.bofh.it> <sY42e-1nr-23@gated-at.bofh.it> <sY4EW-1Px-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jan 10, 2017 at 01:25:12PM +0000, Robin Murphy wrote:
> We still need a way for drivers to communicate a device's probed
> addressing capability to SWIOTLB, so there's always going to have to be
> *some* sort of public interface. Personally, the change in semantics I'd
> like to see is to make dma_set_mask() only fail if DMA is entirely
> disallowed - in the normal case it would always succeed, but the DMA API
> implementation would be permitted to set a smaller mask than requested
> (this is effectively what the x86 IOMMU ops do already).

Yes, this sounds reasonable.

> The significant
> work that would require, though, is changing all the drivers currently
> using this sort of pattern:
> 
> 	if (!dma_set_mask(dev, DMA_BIT_MASK(64))
> 		/* put device into 64-bit mode */
> 	else if (!dma_set_mask(dev, DMA_BIT_MASK(32))
> 		/* put device into 32-bit mode */
> 	else
> 		/* error */

While we have this pattern in a lot of places it's already rather
pointless on most architectures as the first dma_set_mask call
won't ever fail for the most common dma_ops implementations.

> to something like this:
> 
> 	if (!dma_set_mask(dev, DMA_BIT_MASK(64))
> 		/* error */
> 	if (dma_get_mask(dev) > DMA_BIT_MASK(32))
> 		/* put device into 64-bit mode */
> 	else
> 		/* put device into 32-bit mode */
> 
> Which would be a pretty major job.

I don't think it's too bad.  Also for many modern devices there is no
need to put the device into a specific mode.  It's mostly a historic
issue from the PCI/PCI-X days with the less efficient DAC addressing
scheme.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] arm64: do not set dma masks that device connection can't handle Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-09 08:40 +0100
  Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Will Deacon <will.deacon@arm.com> - 2017-01-10 13:00 +0100
    Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-10 13:50 +0100
      Re: [PATCH v2] arm64: do not set dma masks that device connection can't handle Arnd Bergmann <arnd@arndb.de> - 2017-01-10 14:20 +0100
      Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Robin Murphy <robin.murphy@arm.com> - 2017-01-10 14:30 +0100
        Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-10 15:10 +0100
        Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Robin Murphy <robin.murphy@arm.com> - 2017-01-10 15:20 +0100
          Re: [PATCH v2] arm64: do not set dma masks that device connection can't handle Arnd Bergmann <arnd@arndb.de> - 2017-01-10 16:10 +0100
          Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-11 13:40 +0100
            Re: [PATCH v2] arm64: do not set dma masks that device connection can't handle Arnd Bergmann <arnd@arndb.de> - 2017-01-11 17:30 +0100
            Re: [PATCH v2] arm64: do not set dma masks that device connection  can't handle Robin Murphy <robin.murphy@arm.com> - 2017-01-11 19:30 +0100
        Re: [PATCH v2] arm64: do not set dma masks that device connection         can't handle Christoph Hellwig <hch@lst.de> - 2017-01-10 16:00 +0100
        Re: [PATCH v2] arm64: do not set dma masks that device connection         can't handle Christoph Hellwig <hch@lst.de> - 2017-01-10 16:00 +0100
        Re: [PATCH v2] arm64: do not set dma masks that device connection can't handle Arnd Bergmann <arnd@arndb.de> - 2017-01-10 16:10 +0100
      Re: [PATCH v2] arm64: do not set dma masks that device connection         can't handle Christoph Hellwig <hch@lst.de> - 2017-01-10 16:00 +0100

csiph-web