aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/amd_iommu.c
AgeCommit message (Collapse)Author
2009-07-01x86: Mark device_nb as static and fix NULL noiseJaswinder Singh Rajput
This sparse warning: arch/x86/kernel/amd_iommu.c:1195:23: warning: symbol 'device_nb' was not declared. Should it be static? triggers because device_nb is global but is only used in a single .c file. change device_nb to static to fix that - this also addresses the sparse warning. This sparse warning: arch/x86/kernel/amd_iommu.c:1766:10: warning: Using plain integer as NULL pointer triggers because plain integer 0 is used in place of a NULL pointer. change 0 to NULL to fix that - this also address the sparse warning. Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Cc: Joerg Roedel <joerg.roedel@amd.com> LKML-Reference: <1246458194.6940.20.camel@hpdv5.satnam> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-15amd-iommu: flush domain tlb when attaching a new deviceChris Wright
When kexec'ing to a new kernel (for example, when crashing and launching a kdump session), the AMD IOMMU may have cached translations. The kexec'd kernel, during initialization, will invalidate the IOMMU device table entries, but not the domain translations. These stale entries can cause a device's DMA to fail, makes it rough to write a dump to disk when the disk controller can't DMA ;-) Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-09amd-iommu: remove unnecessary "AMD IOMMU: " prefixJoerg Roedel
That prefix is already included in the DUMP_printk macro. So there is no need to repeat it in the format string. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-09amd-iommu: detach device explicitly before attaching it to a new domainJoerg Roedel
This fixes a bug with a device that could not be assigned to a KVM guest because it is still assigned to a dma_ops protection domain. [chrisw: simply remove WARN_ON(), will always fire since dev->driver will be pci-sub] Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-09amd-iommu: remove BUS_NOTIFY_BOUND_DRIVER handlingJoerg Roedel
Handling this event causes device assignment in KVM to fail because the device gets re-attached as soon as the pci-stub registers as the driver for the device. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-09Merge commit 'tip/core/iommu' into amd-iommu/fixesJoerg Roedel
2009-06-03amd_iommu: fix lock imbalanceJiri Slaby
In alloc_coherent there is an omitted unlock on the path where mapping fails. Add the unlock. [ Impact: fix lock imbalance in alloc_coherent ] Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28Merge branches 'amd-iommu/fixes', 'amd-iommu/debug', ↵Joerg Roedel
'amd-iommu/suspend-resume' and 'amd-iommu/extended-allocator' into amd-iommu/2.6.31 Conflicts: arch/x86/kernel/amd_iommu.c arch/x86/kernel/amd_iommu_init.c
2009-05-28amd-iommu: don't free dma adresses below 512MB with CONFIG_IOMMU_STRESSJoerg Roedel
This will test the automatic aperture enlargement code. This is important because only very few devices will ever trigger this code path. So force it under CONFIG_IOMMU_STRESS. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: don't preallocate page tables with CONFIG_IOMMU_STRESSJoerg Roedel
This forces testing of on-demand page table allocation code. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: disable round-robin allocator for CONFIG_IOMMU_STRESSJoerg Roedel
Disabling the round-robin allocator results in reusing the same dma-addresses again very fast. This is a good test if the iotlb flushing is working correctly. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: remove amd_iommu_size kernel parameterJoerg Roedel
This parameter is not longer necessary when aperture increases dynamically. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: enlarge the aperture dynamicallyJoerg Roedel
By dynamically increasing the aperture the extended allocator is now ready for use. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: handle exlusion ranges and unity mappings in alloc_new_rangeJoerg Roedel
This patch makes sure no reserved addresses are allocated in an dma_ops domain when the aperture is increased dynamically. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: move aperture_range allocation code to seperate functionJoerg Roedel
This patch prepares the dynamic increasement of dma_ops domain apertures. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: change dma_dom->next_bit to dma_dom->next_addressJoerg Roedel
Simplify the code a little bit by using the same unit for all address space related state in the dma_ops domain structure. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: make address allocator aware of multiple aperture rangesJoerg Roedel
This patch changes the AMD IOMMU address allocator to allow up to 32 aperture ranges per dma_ops domain. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: handle page table allocation failures in dma_ops codeJoerg Roedel
The code will be required when the aperture size increases dynamically in the extended address allocator. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: move page table allocation code to seperate functionJoerg Roedel
This patch makes page table allocation usable for dma_ops code. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: introduce aperture_range structureJoerg Roedel
This is a preperation for extended address allocator. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: add function to flush tlb for all devicesJoerg Roedel
This function is required for suspend/resume support with AMD IOMMU enabled. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: add function to flush tlb for all domainsJoerg Roedel
This function is required for suspend/resume support with AMD IOMMU enabled. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: introduce for_each_iommu* macrosJoerg Roedel
This patch introduces the for_each_iommu and for_each_iommu_safe macros to simplify the developers life when having to iterate over all AMD IOMMUs in the system. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd iommu: properly detach from protection domain on ->removeChris Wright
Some drivers may use the dma api during ->remove which will cause a protection domain to get reattached to a device. Delay the detach until after the driver is completely unbound. [ joro: added a little merge helper ] [ Impact: fix too early device<->domain removal ] Signed-off-by: Chris Wright <chrisw@redhat.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28amd-iommu: move protection domain printk to dump codeJoerg Roedel
This information is only helpful for debugging. Don't print it anymore unless explicitly requested. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-04-03Merge git://git.infradead.org/iommu-2.6Linus Torvalds
* git://git.infradead.org/iommu-2.6: intel-iommu: Fix address wrap on 32-bit kernel. intel-iommu: Enable DMAR on 32-bit kernel. intel-iommu: fix PCI device detach from virtual machine intel-iommu: VT-d page table to support snooping control bit iommu: Add domain_has_cap iommu_ops intel-iommu: Snooping control support Fixed trivial conflicts in arch/x86/Kconfig and drivers/pci/intel-iommu.c
2009-03-24iommu: Add domain_has_cap iommu_opsSheng Yang
This iommu_op can tell if domain have a specific capability, like snooping control for Intel IOMMU, which can be used by other components of kernel to adjust the behaviour. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-05Merge branch 'iommu/fixes-2.6.29' of ↵Ingo Molnar
git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into core/iommu
2009-03-05AMD IOMMU: remove unnecessary ifdefFUJITA Tomonori
We try to avoid this type of ifdef and we can safely remove this ifdef. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-06x86, ia64: convert to use generic dma_map_ops structFUJITA Tomonori
This converts X86 and IA64 to use include/linux/dma-mapping.h. It's a bit large but pretty boring. The major change for X86 is converting 'int dir' to 'enum dma_data_direction dir' in DMA mapping operations. The major changes for IA64 is using map_page and unmap_page instead of map_single and unmap_single. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-01-06x86: remove map_single and unmap_single in struct dma_mapping_opsFUJITA Tomonori
This patch converts dma_map_single and dma_unmap_single to use map_page and unmap_page respectively and removes unnecessary map_single and unmap_single in struct dma_mapping_ops. This leaves intel-iommu's dma_map_single and dma_unmap_single since IA64 uses them. They will be removed after the unification. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-01-06x86, AMD IOMMU: add map_page and unmap_pageFUJITA Tomonori
This is a preparation of struct dma_mapping_ops unification. We use map_page and unmap_page instead of map_single and unmap_single. We will remove map_single and unmap_single hooks in the last patch in this patchset. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-01-03AMD IOMMU: remove now unnecessary #ifdefsJoerg Roedel
The #ifdef's are no longer necessary when the iommu-api and the amd iommu updates are merged together. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: prealloc_protection_domains should be staticJaswinder Singh Rajput
Impact: cleanup, reduce kernel size a bit, avoid sparse warning Fixes sparse warning: arch/x86/kernel/amd_iommu.c:1299:6: warning: symbol 'prealloc_protection_domains' was not declared. Should it be static? Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add statistics about total number of map requestsJoerg Roedel
Impact: see total number of map requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add statistics about allocated io memoryJoerg Roedel
Impact: see amount of allocated io memory in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for domain tlb flushesJoerg Roedel
Impact: see number of domain tlb flushes in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for single iommu domain tlb flushesJoerg Roedel
Impact: see number of single iommu domain tlb flushes in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for cross-page requestJoerg Roedel
Impact: see number of requests for more than one page in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for free_coherent requestsJoerg Roedel
Impact: see number of free_coherent requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for alloc_coherent requestsJoerg Roedel
Impact: see number of alloc_coherent requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for unmap_sg requestsJoerg Roedel
Impact: see number of unmap_sg requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for map_sg requestsJoerg Roedel
Impact: see number of map_sg requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for unmap_single requestsJoerg Roedel
Impact: see number of unmap_single requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for map_single requestsJoerg Roedel
Impact: see number of map_single requests in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add stats counter for completion wait eventsJoerg Roedel
Impact: see number of completion wait events in debugfs Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: add init code for statistic collectionJoerg Roedel
Impact: create a new debugfs directory Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: use calc_devid in prealloc_protection_domainsJoerg Roedel
Impact: cleanup Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: convert iommu->need_sync to boolJoerg Roedel
Impact: use bool instead of int for iommu->need_sync Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-01-03AMD IOMMU: use dev_name instead of self-build print_devidJoerg Roedel
Impact: use generic dev_name instead of own function Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>