|
@@ -42,16 +42,27 @@ static struct dma_map_ops swiotlb_dma_ops = {
|
|
.dma_supported = NULL,
|
|
.dma_supported = NULL,
|
|
};
|
|
};
|
|
|
|
|
|
-void __init pci_swiotlb_init(void)
|
|
|
|
|
|
+/*
|
|
|
|
+ * pci_swiotlb_init - initialize swiotlb if necessary
|
|
|
|
+ *
|
|
|
|
+ * This returns non-zero if we are forced to use swiotlb (by the boot
|
|
|
|
+ * option).
|
|
|
|
+ */
|
|
|
|
+int __init pci_swiotlb_init(void)
|
|
{
|
|
{
|
|
/* don't initialize swiotlb if iommu=off (no_iommu=1) */
|
|
/* don't initialize swiotlb if iommu=off (no_iommu=1) */
|
|
#ifdef CONFIG_X86_64
|
|
#ifdef CONFIG_X86_64
|
|
if (!no_iommu && max_pfn > MAX_DMA32_PFN)
|
|
if (!no_iommu && max_pfn > MAX_DMA32_PFN)
|
|
swiotlb = 1;
|
|
swiotlb = 1;
|
|
#endif
|
|
#endif
|
|
|
|
+ if (swiotlb_force)
|
|
|
|
+ swiotlb = 1;
|
|
|
|
+
|
|
if (swiotlb) {
|
|
if (swiotlb) {
|
|
swiotlb_init(0);
|
|
swiotlb_init(0);
|
|
dma_ops = &swiotlb_dma_ops;
|
|
dma_ops = &swiotlb_dma_ops;
|
|
} else
|
|
} else
|
|
dma_ops = &nommu_dma_ops;
|
|
dma_ops = &nommu_dma_ops;
|
|
|
|
+
|
|
|
|
+ return swiotlb_force;
|
|
}
|
|
}
|