mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 00:54:41 +08:00
9aa1fbc50d
The original form of these was added (to the HP zx1 platform only) by the following bitkeeper commit (by the way of the historic.git tree): commit 66b99421d118a5ddd98a72913670b0fcf0a38d45 Author: Andrew Morton <akpm@osdl.org> Date: Sat Mar 13 17:05:37 2004 -0800 [PATCH] DMA: Fill gaping hole in DMA API interfaces. From: "David S. Miller" <davem@redhat.com> The commit does not explain why we'd need the memory barrier on ia64, it never included the swiotlb or SGI IOMMU based platforms, and also failed to address the map/unmap parts of the dma mapping interface, which should provide the same ordering semantics and actually are commonly used. The conclusion of this is that they were added in error and should be removed. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Tony Luck <tony.luck@intel.com>
62 lines
1.2 KiB
C
62 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Dynamic DMA mapping support.
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/string.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/module.h>
|
|
#include <linux/dmar.h>
|
|
#include <asm/iommu.h>
|
|
#include <asm/machvec.h>
|
|
#include <linux/dma-mapping.h>
|
|
#include <linux/kernel.h>
|
|
#include <asm/page.h>
|
|
|
|
int no_iommu __read_mostly;
|
|
#ifdef CONFIG_IOMMU_DEBUG
|
|
int force_iommu __read_mostly = 1;
|
|
#else
|
|
int force_iommu __read_mostly;
|
|
#endif
|
|
|
|
int iommu_pass_through;
|
|
|
|
extern struct dma_map_ops intel_dma_ops;
|
|
|
|
static int __init pci_iommu_init(void)
|
|
{
|
|
if (iommu_detected)
|
|
intel_iommu_init();
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* Must execute after PCI subsystem */
|
|
fs_initcall(pci_iommu_init);
|
|
|
|
void __init pci_iommu_alloc(void)
|
|
{
|
|
dma_ops = &intel_dma_ops;
|
|
|
|
/*
|
|
* The order of these functions is important for
|
|
* fall-back/fail-over reasons
|
|
*/
|
|
detect_intel_iommu();
|
|
|
|
#ifdef CONFIG_SWIOTLB
|
|
if (!iommu_detected) {
|
|
#ifdef CONFIG_IA64_GENERIC
|
|
printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
|
|
machvec_init("dig");
|
|
swiotlb_dma_init();
|
|
#else
|
|
panic("Unable to find Intel IOMMU");
|
|
#endif /* CONFIG_IA64_GENERIC */
|
|
}
|
|
#endif /* CONFIG_SWIOTLB */
|
|
}
|