android_kernel_xiaomi_sdm845/include
FUJITA Tomonori 8d8bb39b9e dma-mapping: add the device argument to dma_mapping_error()
Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
architecture does:

This enables us to cleanly fix the Calgary IOMMU issue that some devices
are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).

I think that per-device dma_mapping_ops support would be also helpful for
KVM people to support PCI passthrough but Andi thinks that this makes it
difficult to support the PCI passthrough (see the above thread).  So I
CC'ed this to KVM camp.  Comments are appreciated.

A pointer to dma_mapping_ops to struct dev_archdata is added.  If the
pointer is non NULL, DMA operations in asm/dma-mapping.h use it.  If it's
NULL, the system-wide dma_ops pointer is used as before.

If it's useful for KVM people, I plan to implement a mechanism to register
a hook called when a new pci (or dma capable) device is created (it works
with hot plugging).  It enables IOMMUs to set up an appropriate
dma_mapping_ops per device.

The major obstacle is that dma_mapping_error doesn't take a pointer to the
device unlike other DMA operations.  So x86 can't have dma_mapping_ops per
device.  Note all the POWER IOMMUs use the same dma_mapping_error function
so this is not a problem for POWER but x86 IOMMUs use different
dma_mapping_error functions.

The first patch adds the device argument to dma_mapping_error.  The patch
is trivial but large since it touches lots of drivers and dma-mapping.h in
all the architecture.

This patch:

dma_mapping_error() doesn't take a pointer to the device unlike other DMA
operations.  So we can't have dma_mapping_ops per device.

Note that POWER already has dma_mapping_ops per device but all the POWER
IOMMUs use the same dma_mapping_error function.  x86 IOMMUs use device
argument.

[akpm@linux-foundation.org: fix sge]
[akpm@linux-foundation.org: fix svc_rdma]
[akpm@linux-foundation.org: build fix]
[akpm@linux-foundation.org: fix bnx2x]
[akpm@linux-foundation.org: fix s2io]
[akpm@linux-foundation.org: fix pasemi_mac]
[akpm@linux-foundation.org: fix sdhci]
[akpm@linux-foundation.org: build fix]
[akpm@linux-foundation.org: fix sparc]
[akpm@linux-foundation.org: fix ibmvscsi]
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-26 12:00:03 -07:00
..
acpi Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2008-07-16 17:25:46 -07:00
asm-alpha dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-arm dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-avr32 dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-blackfin Merge git://git.infradead.org/~dwmw2/random-2.6 2008-07-25 12:01:37 -07:00
asm-cris dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-frv dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-generic dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-h8300 Merge git://git.infradead.org/~dwmw2/random-2.6 2008-07-25 12:01:37 -07:00
asm-ia64 dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-m32r Merge git://git.infradead.org/~dwmw2/random-2.6 2008-07-25 12:01:37 -07:00
asm-m68k dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-m68knommu Merge git://git.infradead.org/~dwmw2/random-2.6 2008-07-25 12:01:37 -07:00
asm-mips dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-mn10300 dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-parisc dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-powerpc dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-s390 Merge git://git.infradead.org/~dwmw2/random-2.6 2008-07-25 12:01:37 -07:00
asm-sh dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-sparc dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-sparc64 remove dummy asm/kvm.h files 2008-07-25 14:35:50 -04:00
asm-um Merge git://git.infradead.org/~dwmw2/random-2.6 2008-07-25 12:01:37 -07:00
asm-v850 remove the v850 port 2008-07-24 10:47:24 -07:00
asm-x86 dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
asm-xtensa dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
crypto crypto: hash - Move ahash functions into crypto/hash.h 2008-07-10 20:35:18 +08:00
drm drm/radeon: fixup issue with radeon and PAT support. 2008-07-15 15:48:05 +10:00
keys
linux dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
math-emu
media V4L/DVB (8395): saa7134: Fix Kbuild dependency of ir-kbd-i2c 2008-07-20 07:29:03 -03:00
mtd UBI: fix checkpatch.pl errors and warnings 2008-07-24 13:36:09 +03:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-07-25 17:40:16 -07:00
pcmcia pcmcia: (re)move {pcmcia,pccard}_get_status 2008-06-24 15:33:44 +02:00
rdma dma-mapping: add the device argument to dma_mapping_error() 2008-07-26 12:00:03 -07:00
rxrpc
scsi driver core: remove KOBJ_NAME_LEN define 2008-07-21 21:54:52 -07:00
sound ALSA: Release v1.0.17 2008-07-14 09:54:43 +02:00
video include/video/atmel_lcdc.h must #include <linux/workqueue.h> 2008-07-26 12:00:01 -07:00
xen xen: implement Xen-specific spinlocks 2008-07-16 11:15:53 +02:00
Kbuild drm: reorganise drm tree to be more future proof. 2008-07-14 10:45:01 +10:00