aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2008-12-23Merge branch 'x86/iommu' into x86/coreIngo Molnar1-0/+1
2008-12-17AMD IOMMU: panic if completion wait loop failsJoerg Roedel1-2/+3
Impact: prevents data corruption after a failed completion wait loop Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-08AMD IOMMU: __unmap_single: check for bad_dma_address instead of 0Joerg Roedel1-1/+2
Impact: minor fix Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-08AMD IOMMU: fix WARN_ON in dma_ops unmap pathJoerg Roedel1-1/+1
Impact: minor fix Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-08AMD IOMMU: fix typo in commentJoerg Roedel1-2/+2
Impact: cleanup Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-08AMD IOMMU: fix loop counter in free_pagetable functionJoerg Roedel1-1/+1
Impact: bugfix Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-08AMD IOMMU: fix iommu_map_page functionJoerg Roedel1-1/+1
Impact: bugfix in iommu_map_page function Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-03AMD IOMMU: fix possible race while accessing iommu->need_syncJoerg Roedel1-20/+13
The access to the iommu->need_sync member needs to be protected by the iommu->lock. Otherwise this is a possible race condition. Fix it with this patch. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-03AMD IOMMU: set device table entry for aliased devicesJoerg Roedel1-0/+3
In some rare cases a request can arrive an IOMMU with its originial requestor id even it is aliased. Handle this by setting the device table entry to the same protection domain for the original and the aliased requestor id. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-12-01Merge branch 'x86/urgent' into x86/iommuIngo Molnar1-1/+1
2008-11-28x86: move GART specific stuff from iommu.h to gart.hJoerg Roedel1-0/+1
Impact: cleanup Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-18AMD IOMMU: check for next_bit also in unmapped areaJoerg Roedel1-1/+1
Impact: fix possible use of stale IO/TLB entries Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-11-06Merge branch 'iommu-fixes-2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into x86/urgentIngo Molnar1-2/+7
2008-11-06AMD IOMMU: fix lazy IO/TLB flushing in unmap pathJoerg Roedel1-1/+6
Lazy flushing needs to take care of the unmap path too which is not yet implemented and leads to stale IO/TLB entries. This is fixed by this patch. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-10-30AMD IOMMU: fix detection of NP capable IOMMUsJoerg Roedel1-1/+1
This patch changes the code to use IOMMU_CAP_NPCACHE as a shift and not as a mask. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2008-10-16x86, AMD IOMMU: convert driver to generic iommu_num_pages functionJoerg Roedel1-5/+6
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Muli Ben-Yehuda <muli@il.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-16x86: rename iommu_num_pages function to iommu_nr_pagesJoerg Roedel1-4/+4
This series of patches re-introduces the iommu_num_pages function so that it can be used by each architecture specific IOMMU implementations. The series also changes IOMMU implementations for X86, Alpha, PowerPC and UltraSparc. The other implementations are not yet changed because the modifications required are not obvious and I can't test them on real hardware. This patch: This is a preparation patch for introducing a generic iommu_num_pages function. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Muli Ben-Yehuda <muli@il.ibm.com> Cc: Dave Airlie <airlied@linux.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-10Merge branches 'core/iommu', 'x86/amd-iommu' and 'x86/iommu' into x86-v28-for-linus-phase3-BIngo Molnar1-61/+267
Conflicts: arch/x86/kernel/pci-gart_64.c include/asm-x86/dma-mapping.h
2008-10-02AMD IOMMU: use iommu_device_max_indexFUJITA Tomonori1-7/+3
AMD IOMMU can use iommu_device_max_index() instead of the homegrown function. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-22iommu: remove fullflush and nofullflush in IOMMU generic optionFUJITA Tomonori1-2/+2
This patch against tip/x86/iommu virtually reverts 2842e5bf3115193f05dc9dac20f940e7abf44c1a. But just reverting the commit breaks AMD IOMMU so this patch also includes some fixes. The above commit adds new two options to x86 IOMMU generic kernel boot options, fullflush and nofullflush. But such change that affects all the IOMMUs needs more discussion (all IOMMU parties need the chance to discuss it): http://lkml.org/lkml/2008/9/19/106 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-22iommu: export iommu_area_reserve helper functionFUJITA Tomonori1-1/+1
x86 has set_bit_string() that does the exact same thing that set_bit_area() in lib/iommu-helper.c does. This patch exports set_bit_area() in lib/iommu-helper.c as iommu_area_reserve(), converts GART, Calgary, and AMD IOMMU to use it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: use coherent_dma_mask in alloc_coherentJoerg Roedel1-7/+22
The alloc_coherent implementation for AMD IOMMU currently uses *dev->dma_mask per default. This patch changes it to prefer dev->coherent_dma_mask if it is set. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: simplify dma_mask_to_pagesJoerg Roedel1-2/+1
The current calculation is very complicated. This patch replaces it with a much simpler version. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: replace memset with __GFP_ZERO in alloc_coherentJoerg Roedel1-1/+1
Remove the memset and use __GFP_ZERO at allocation time instead. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: avoid unnecessary low zone allocation in alloc_coherentFUJITA Tomonori1-2/+3
x86's common alloc_coherent (dma_alloc_coherent in dma-mapping.h) sets up the gfp flag according to the device dma_mask but AMD IOMMU doesn't need it for devices that the IOMMU can do virtual mappings for. This patch avoids unnecessary low zone allocation. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: some set_device_domain cleanupsJoerg Roedel1-4/+5
Remove some magic numbers and split the pte_root using standard functions. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: don't assign preallocated protection domains to devicesJoerg Roedel1-5/+38
In isolation mode the protection domains for the devices are preallocated and preassigned. This is bad if a device should be passed to a virtualization guest because the IOMMU code does not know if it is in use by a driver. This patch changes the code to assign the device to the preallocated domain only if there are dma mapping requests for it. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: add dma_supported callbackJoerg Roedel1-0/+25
This function determines if the AMD IOMMU implementation is responsible for a given device. So the DMA layer can get this information from the driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: add event handling codeJoerg Roedel1-1/+86
This patch adds code for polling and printing out events generated by the AMD IOMMU. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: add MSI interrupt supportJoerg Roedel1-0/+11
The AMD IOMMU can generate interrupts for various reasons. This patch adds the basic interrupt enabling infrastructure to the driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: align alloc_coherent addresses properlyJoerg Roedel1-8/+14
The API definition for dma_alloc_coherent states that the bus address has to be aligned to the next power of 2 boundary greater than the allocation size. This is violated by AMD IOMMU so far and this patch fixes it. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: add branch hints to completion wait checksJoerg Roedel1-6/+6
This patch adds branch hints to the cecks if a completion_wait is necessary. The completion_waits in the mapping paths are unlikly because they will only happen on software implementations of AMD IOMMU which don't exists today or with lazy IO/TLB flushing when the allocator wraps around the address space. With lazy IO/TLB flushing the completion_wait in the unmapping path is unlikely too. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: implement lazy IO/TLB flushingJoerg Roedel1-4/+22
The IO/TLB flushing on every unmaping operation is the most expensive part in AMD IOMMU code and not strictly necessary. It is sufficient to do the flush before any entries are reused. This is patch implements lazy IO/TLB flushing which does exactly this. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: move TLB flushing to the map/unmap helper functionsJoerg Roedel1-14/+5
This patch moves the invocation of the flushing functions to the map/unmap helpers because its common code in all dma_ops relevant mapping/unmapping code. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-19AMD IOMMU: check for invalid device pointersJoerg Roedel1-8/+35
Currently AMD IOMMU code triggers a BUG_ON if NULL is passed as the device. This is inconsistent with other IOMMU implementations. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-18AMD IOMMU: protect completion wait loop with iommu lockJoerg Roedel1-4/+8
The unlocked polling of the ComWaitInt bit in the IOMMU completion wait path is racy. Protect it with the iommu lock. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-18AMD IOMMU: set iommu sunc flag after command queuingJoerg Roedel1-2/+8
The iommu->need_sync flag must be set after the command is queued to avoid race conditions. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-10Merge commit 'v2.6.27-rc6' into x86/iommuIngo Molnar1-1/+1
2008-08-22x86, AMD IOMMU: remove obsolete FIXME commentJoerg Roedel1-2/+0
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-08-19x86 iommu: remove unneeded parenthesisJiri Kosina1-1/+1
The parenthesis in __iommu_queue_command() are not needed when assigning into 'target' variable. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-08-15x86m AMD IOMMU: cleanup: replace LOW_U32 macro with generic lower_32_bitsJoerg Roedel1-1/+1
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-08-15x86, AMD IOMMU: use status bit instead of memory write-back for completion waitJoerg Roedel1-7/+10
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-28Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linusJesse Barnes1-8/+5
2008-07-26x86, AMD IOMMU: include amd_iommu_last_bdf in device initializationJoerg Roedel1-2/+2
All the values read while searching for amd_iommu_last_bdf are defined as inclusive. Let the code handle this value as such. Found by Wei Wang. Thanks Wei. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@amd.com Cc: Wei Wang <wei.wang2@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-26x86, AMD IOMMU: replace to_pages macro with iommu_num_pagesJoerg Roedel1-8/+5
This patch removes the to_pages macro from AMD IOMMU code and calls the generic iommu_num_pages function instead. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-21Merge branches 'x86/urgent', 'x86/amd-iommu', 'x86/apic', 'x86/cleanups', 'x86/core', 'x86/cpu', 'x86/fixmap', 'x86/gart', 'x86/kprobes', 'x86/memtest', 'x86/modules', 'x86/nmi', 'x86/pat', 'x86/reboot', 'x86/setup', 'x86/step', 'x86/unify-pci', 'x86/uv', 'x86/xen' and 'xen-64bit' into x86/for-linusIngo Molnar1-13/+218
2008-07-11x86, AMD IOMMU: replace DEVID macro with a functionJoerg Roedel1-1/+1
This patch replaces the DEVID macro with a function and uses them where apropriate (also in the core code). Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-11x86, AMD IOMMU: rename struct command to iommu_cmdJoerg Roedel1-6/+6
This patch gives the struct command a more descriptive and not so generic name. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-11x86, AMD IOMMU: add an emergency exit to the completion wait loopJoerg Roedel1-1/+9
To make the loop waiting for the completion wait command not wait forever this patch adds a limit of cycles that loop. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-11x86, AMD IOMMU: replace HIGH_U32 macro with upper_32_bits functionJoerg Roedel1-2/+2
Removes a driver specific macro and replaces it with a generic function already available in Linux. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@elte.hu>