linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 00/51] Preview of DMA mask changes
@ 2013-08-01 21:34 Russell King - ARM Linux
  2013-08-01 21:35 ` [PATCH RFC 01/51] DMA-API: provide a helper to set both DMA and coherent DMA masks Russell King
                   ` (51 more replies)
  0 siblings, 52 replies; 59+ messages in thread
From: Russell King - ARM Linux @ 2013-08-01 21:34 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Arnd Bergmann, Catalin Marinas, Chris Ball, Jens Axboe,
	linux-kernel, linux-scsi, Nicolas Pitre, Will Deacon

So, this patch set is a preview of the DMA mask changes which I currently
have in my tree.

This started out as a request to look at the DMA mask situation, and how
to solve the issues which we have on ARM.  One of those issues is how to
deal with the DT side of things, which I haven't yet addressed.

However, I started off reviewing how the dma_mask and coherent_dma_mask
was being used, and what I found was rather messy, and in some cases
rather buggy.  I tried to get some of the bug fixes in before the last
merge window, but it seems that the maintainers preferred to have the
full solution rather than a simple -rc suitable bug fix.

So, this is an attempt to clean things up.

The first point here is that drivers performing DMA should be calling
dma_set_mask()/dma_set_coherent_mask() in their probe function to verify
that DMA can be performed.  Lots of ARM drivers omit this step; please
refer to the DMA API documentation on this subject.

What this means is that the DMA mask provided by bus code is a default
value - nothing more.  It doesn't have to accurately reflect what the
device is actually capable of.  Apart from the storage for dev->dma_mask
being initialised for any device which is DMA capable, there is no other
initialisation which is strictly necessary at device creation time.

Now, these cleanups address two major areas:
1. The setting of DMA masks, particularly when both the coherent and
   streaming DMA masks are set together.

2. The initialisation of DMA masks by drivers - this seems to be becoming
   a popular habbit, one which may not be entirely the right solution.
   Rather than having this scattered throughout the tree, I've pulled
   that into a central location (and called it coercing the DMA mask -
   because it really is about forcing the DMA mask to be that value.)

3. Finally, addressing the long held misbelief that DMA masks somehow
   correspond with physical addresses.  We already have established
   long ago that dma_addr_t values returned from the DMA API are the
   values which you program into the DMA controller, and so are the
   bus addresses.  It is _only_ sane that DMA masks are also bus
   related too, and not related to physical address spaces.

(3) is a very important point for LPAE systems, which may still have
less than 4GB of memory, but this memory is all located above the 4GB
physical boundary.  This means with the current model, any device
using a 32-bit DMA mask fails - even though the DMA controller is
still only a 32-bit DMA controller but the 32-bit bus addresses map
to system memory.  To put it another way, the bus addresses have a
4GB physical offset on them.

This work is ongoing, and I'm still fixing the odd bug which the nightly
autobuilder randconfigs find (when it doesn't hit some other problem.)

I'm not using get_maintainer.pl for this series yet, because the list
of recipients is gigantic and would not pass through vger's filters,
let alone other mailing lists.  So this initial posting will only be
sent to those listed explicitly in Cc:'s in the patches, linux-kernel
and linux-arm-kernel... and it will take about an hour to send all
these patches out.

Patches based on -rc2.

 Documentation/DMA-API-HOWTO.txt                   |   37 +++++++++------
 Documentation/DMA-API.txt                         |    8 +++
 arch/arm/include/asm/dma-mapping.h                |    8 +++
 arch/arm/mm/dma-mapping.c                         |   49 ++++++++++++++++++--
 arch/arm/mm/init.c                                |   12 +++---
 arch/arm/mm/mm.h                                  |    2 +
 arch/powerpc/kernel/vio.c                         |    3 +-
 block/blk-settings.c                              |    8 ++--
 drivers/amba/bus.c                                |    6 +--
 drivers/ata/pata_ixp4xx_cf.c                      |    5 ++-
 drivers/ata/pata_octeon_cf.c                      |    5 +-
 drivers/block/nvme-core.c                         |    7 +--
 drivers/crypto/ixp4xx_crypto.c                    |   48 ++++++++++----------
 drivers/dma/amba-pl08x.c                          |    5 ++
 drivers/dma/dw/platform.c                         |    8 +--
 drivers/dma/edma.c                                |    6 +--
 drivers/dma/pl330.c                               |    4 ++
 drivers/firmware/dcdbas.c                         |   23 +++++-----
 drivers/firmware/google/gsmi.c                    |   13 +++--
 drivers/gpu/drm/exynos/exynos_drm_drv.c           |    7 +++-
 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c          |    5 +-
 drivers/media/platform/omap3isp/isp.c             |    6 +-
 drivers/media/platform/omap3isp/isp.h             |    3 -
 drivers/mmc/card/queue.c                          |    3 +-
 drivers/mmc/host/sdhci-acpi.c                     |    5 +-
 drivers/net/ethernet/broadcom/b44.c               |    3 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c  |    8 +---
 drivers/net/ethernet/brocade/bna/bnad.c           |   13 ++----
 drivers/net/ethernet/emulex/benet/be_main.c       |   12 +----
 drivers/net/ethernet/intel/e1000/e1000_main.c     |    9 +---
 drivers/net/ethernet/intel/e1000e/netdev.c        |   18 +++-----
 drivers/net/ethernet/intel/igb/igb_main.c         |   18 +++-----
 drivers/net/ethernet/intel/igbvf/netdev.c         |   18 +++-----
 drivers/net/ethernet/intel/ixgb/ixgb_main.c       |   16 ++-----
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |   15 ++----
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   15 ++----
 drivers/net/ethernet/nxp/lpc_eth.c                |    6 ++-
 drivers/net/ethernet/octeon/octeon_mgmt.c         |    5 +-
 drivers/net/ethernet/sfc/efx.c                    |   12 +-----
 drivers/net/wireless/b43/dma.c                    |    9 +---
 drivers/net/wireless/b43legacy/dma.c              |    9 +---
 drivers/of/platform.c                             |    3 -
 drivers/parport/parport_pc.c                      |    8 +++-
 drivers/scsi/scsi_lib.c                           |    2 +-
 drivers/staging/dwc2/platform.c                   |    5 +-
 drivers/staging/et131x/et131x.c                   |   17 +------
 drivers/staging/imx-drm/imx-drm-core.c            |    8 +++-
 drivers/staging/imx-drm/ipuv3-crtc.c              |    4 +-
 drivers/staging/media/dt3155v4l/dt3155v4l.c       |    5 +--
 drivers/usb/chipidea/ci_hdrc_imx.c                |    7 +--
 drivers/usb/dwc3/dwc3-exynos.c                    |    7 +--
 drivers/usb/gadget/lpc32xx_udc.c                  |    4 +-
 drivers/usb/host/bcma-hcd.c                       |    3 +-
 drivers/usb/host/ehci-atmel.c                     |    7 +--
 drivers/usb/host/ehci-octeon.c                    |    4 +-
 drivers/usb/host/ehci-omap.c                      |   10 ++--
 drivers/usb/host/ehci-orion.c                     |    7 +--
 drivers/usb/host/ehci-platform.c                  |   10 ++--
 drivers/usb/host/ehci-s5p.c                       |    7 +--
 drivers/usb/host/ehci-spear.c                     |    7 +--
 drivers/usb/host/ehci-tegra.c                     |    7 +--
 drivers/usb/host/ohci-at91.c                      |    9 ++--
 drivers/usb/host/ohci-exynos.c                    |    7 +--
 drivers/usb/host/ohci-nxp.c                       |    5 +-
 drivers/usb/host/ohci-octeon.c                    |    5 +-
 drivers/usb/host/ohci-omap3.c                     |   10 ++--
 drivers/usb/host/ohci-pxa27x.c                    |    8 ++--
 drivers/usb/host/ohci-sa1111.c                    |    6 +++
 drivers/usb/host/ohci-spear.c                     |    7 +--
 drivers/usb/host/ssb-hcd.c                        |    3 +-
 drivers/usb/host/uhci-platform.c                  |    7 +--
 drivers/usb/musb/am35x.c                          |   50 +++++++--------------
 drivers/usb/musb/da8xx.c                          |   49 +++++++-------------
 drivers/usb/musb/davinci.c                        |   48 +++++++-------------
 drivers/usb/musb/tusb6010.c                       |   49 +++++++-------------
 drivers/video/amba-clcd.c                         |    5 ++
 include/linux/amba/bus.h                          |    2 -
 include/linux/dma-mapping.h                       |   31 +++++++++++++
 sound/arm/pxa2xx-pcm.c                            |    9 +---
 sound/soc/atmel/atmel-pcm.c                       |   11 ++---
 sound/soc/blackfin/bf5xx-ac97-pcm.c               |   11 ++---
 sound/soc/blackfin/bf5xx-i2s-pcm.c                |   10 ++---
 sound/soc/davinci/davinci-pcm.c                   |    9 +---
 sound/soc/fsl/fsl_dma.c                           |    9 +---
 sound/soc/fsl/mpc5200_dma.c                       |   10 ++---
 sound/soc/jz4740/jz4740-pcm.c                     |   12 ++---
 sound/soc/kirkwood/kirkwood-dma.c                 |    9 +---
 sound/soc/nuc900/nuc900-pcm.c                     |    9 ++--
 sound/soc/omap/omap-pcm.c                         |   11 ++---
 sound/soc/pxa/pxa2xx-pcm.c                        |   11 ++---
 sound/soc/s6000/s6000-pcm.c                       |    9 +---
 sound/soc/samsung/dma.c                           |   11 ++---
 sound/soc/samsung/idma.c                          |   11 ++---
 93 files changed, 492 insertions(+), 565 deletions(-)


^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2013-08-14 10:39 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 21:34 [PATCH RFC 00/51] Preview of DMA mask changes Russell King - ARM Linux
2013-08-01 21:35 ` [PATCH RFC 01/51] DMA-API: provide a helper to set both DMA and coherent DMA masks Russell King
2013-08-01 21:36 ` [PATCH RFC 02/51] DMA-API: net: brocade/bna/bnad.c: fix 32-bit DMA mask handling Russell King
2013-08-01 21:37 ` [PATCH RFC 03/51] DMA-API: net: intel/e1000e: " Russell King
2013-08-01 21:38 ` [PATCH RFC 04/51] DMA-API: net: intel/igb: " Russell King
2013-08-01 21:39 ` [PATCH RFC 05/51] DMA-API: net: intel/igbvf: " Russell King
2013-08-01 21:40 ` [PATCH RFC 06/51] DMA-API: net: intel/ixgb: " Russell King
2013-08-01 21:41 ` [PATCH RFC 07/51] DMA-API: net: intel/ixgbe: " Russell King
2013-08-01 21:42 ` [PATCH RFC 08/51] DMA-API: net: intel/ixgbevf: " Russell King
2013-08-01 21:43 ` [PATCH RFC 09/51] DMA-API: net: broadcom/b44: replace dma_set_mask()+dma_set_coherent_mask() with new helper Russell King
2013-08-01 21:44 ` [PATCH RFC 10/51] DMA-API: net: broadcom/bnx2x: " Russell King
2013-08-01 21:45 ` [PATCH RFC 11/51] DMA-API: net: emulex/benet: " Russell King
2013-08-01 21:46 ` [PATCH RFC 12/51] DMA-API: net: intel/e1000: " Russell King
2013-08-01 21:47 ` [PATCH RFC 13/51] DMA-API: net: sfc/efx.c: " Russell King
2013-08-01 21:48 ` [PATCH RFC 14/51] DMA-API: net: b43: " Russell King
2013-08-01 21:49 ` [PATCH RFC 15/51] DMA-API: net: b43legacy: " Russell King
2013-08-01 21:50 ` [PATCH RFC 16/51] DMA-API: ppc: vio.c: " Russell King
2013-08-01 21:51 ` [PATCH RFC 17/51] DMA-API: block: nvme-core: " Russell King
2013-08-01 21:52 ` [PATCH RFC 18/51] DMA-API: staging: et131x: " Russell King
2013-08-01 21:53 ` [PATCH RFC 19/51] DMA-API: media: dt3155v4l: " Russell King
2013-08-01 21:54 ` [PATCH RFC 20/51] DMA-API: usb: bcma: " Russell King
2013-08-01 21:55 ` [PATCH RFC 21/51] DMA-API: usb: ssb-hcd: " Russell King
2013-08-01 21:56 ` [PATCH RFC 22/51] DMA-API: amba: get rid of separate dma_mask Russell King
2013-08-01 21:57 ` [PATCH RFC 23/51] DMA-API: dma: pl08x: add dma_set_mask_and_coherent() call Russell King
2013-08-01 21:58 ` [PATCH RFC 24/51] DMA-API: dma: pl330: " Russell King
2013-08-01 21:59 ` [PATCH RFC 25/51] DMA-API: video: clcd: " Russell King
2013-08-01 22:00 ` [PATCH RFC 26/51] DMA-API: usb: ohci-sa1111: add a note about DMA masks Russell King
2013-08-01 22:01 ` [PATCH RFC 27/51] DMA-API: provide a helper to setup " Russell King
2013-08-01 22:02 ` [PATCH RFC 28/51] DMA-API: sound: fix dma mask handling in a lot of drivers Russell King
2013-08-01 22:03 ` [PATCH RFC 29/51] DMA-API: ata: pata_octeon_cf: convert to use dma_coerce_mask_and_coherent() Russell King
2013-08-01 22:04 ` [PATCH RFC 30/51] DMA-API: dma: dw_dmac.c: " Russell King
2013-08-01 22:05 ` [PATCH RFC 31/51] DMA-API: media: omap3isp: " Russell King
2013-08-01 22:06 ` [PATCH RFC 32/51] DMA-API: mmc: sdhci-acpi: " Russell King
2013-08-01 22:07 ` [PATCH RFC 33/51] DMA-API: net: nxp/lpc_eth: " Russell King
2013-08-01 22:08 ` [PATCH RFC 34/51] DMA-API: net: octeon: " Russell King
2013-08-01 22:09 ` [PATCH RFC 35/51] DMA-API: parport: parport_pc.c: " Russell King
2013-08-01 22:10 ` [PATCH RFC 36/51] DMA-API: usb: use dma_set_coherent_mask() Russell King
2013-08-01 22:11 ` [PATCH RFC 37/51] DMA-API: usb: use new dma_coerce_mask_and_coherent() Russell King
2013-08-01 22:12 ` [PATCH RFC 38/51] DMA-API: staging: use dma_set_coherent_mask() Russell King
2013-08-01 22:13 ` [PATCH RFC 39/51] DMA-API: others: " Russell King
2013-08-01 22:14 ` [PATCH RFC 40/51] DMA-API: crypto: fix ixp4xx crypto platform device support Russell King
2013-08-01 22:15 ` [PATCH RFC 41/51] DMA-API: crypto: remove last references to 'static struct device *dev' Russell King
2013-08-01 22:16 ` [PATCH RFC 42/51] DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks Russell King
2013-08-01 22:17 ` [PATCH RFC 43/51] DMA-API: dma: edma.c: no need to explicitly initialize DMA masks Russell King
2013-08-01 22:18 ` [PATCH RFC 44/51] DMA-API: dcdbas: update DMA mask handing Russell King
2013-08-01 22:19 ` [PATCH RFC 45/51] DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks Russell King
2013-08-01 22:20 ` [PATCH RFC 46/51] ARM: DMA-API: better handing of DMA masks for coherent allocations Russell King
2013-08-05 22:43   ` Rob Herring
2013-08-05 23:44     ` Russell King - ARM Linux
2013-08-09 11:35   ` Tushar Behera
2013-08-01 22:21 ` [PATCH RFC 47/51] ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit() Santosh Shilimkar
2013-08-01 22:37   ` Russell King - ARM Linux
2013-08-01 22:22 ` [PATCH RFC 48/51] ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function Santosh Shilimkar
2013-08-01 22:23 ` [PATCH RFC 49/51] ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations Santosh Shilimkar
2013-08-01 22:24 ` [PATCH RFC 50/51] ARM: 7797/1: mmc: " Santosh Shilimkar
2013-08-01 22:25 ` [PATCH RFC 51/51] ARM: 7805/1: mm: change max*pfn to include the physical offset of memory Santosh Shilimkar
2013-08-06  3:15   ` Rob Herring
2013-08-06  8:51     ` Russell King - ARM Linux
2013-08-14 10:38 ` [PATCH RFC 00/51] Preview of DMA mask changes Russell King - ARM Linux

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).