aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/pci-dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/pci-dma.c')
-rw-r--r--arch/x86/kernel/pci-dma.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 599d7462eccc..df7ab02f959f 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -1,5 +1,5 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#include <linux/dma-mapping.h> 2#include <linux/dma-direct.h>
3#include <linux/dma-debug.h> 3#include <linux/dma-debug.h>
4#include <linux/dmar.h> 4#include <linux/dmar.h>
5#include <linux/export.h> 5#include <linux/export.h>
@@ -87,7 +87,6 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
87 87
88 dma_mask = dma_alloc_coherent_mask(dev, flag); 88 dma_mask = dma_alloc_coherent_mask(dev, flag);
89 89
90 flag &= ~__GFP_ZERO;
91again: 90again:
92 page = NULL; 91 page = NULL;
93 /* CMA can be used only in the context which permits sleeping */ 92 /* CMA can be used only in the context which permits sleeping */
@@ -139,7 +138,6 @@ bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp)
139 if (!*dev) 138 if (!*dev)
140 *dev = &x86_dma_fallback_dev; 139 *dev = &x86_dma_fallback_dev;
141 140
142 *gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
143 *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp); 141 *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp);
144 142
145 if (!is_device_dma_capable(*dev)) 143 if (!is_device_dma_capable(*dev))
@@ -217,7 +215,7 @@ static __init int iommu_setup(char *p)
217} 215}
218early_param("iommu", iommu_setup); 216early_param("iommu", iommu_setup);
219 217
220int x86_dma_supported(struct device *dev, u64 mask) 218int arch_dma_supported(struct device *dev, u64 mask)
221{ 219{
222#ifdef CONFIG_PCI 220#ifdef CONFIG_PCI
223 if (mask > 0xffffffff && forbid_dac > 0) { 221 if (mask > 0xffffffff && forbid_dac > 0) {
@@ -226,12 +224,6 @@ int x86_dma_supported(struct device *dev, u64 mask)
226 } 224 }
227#endif 225#endif
228 226
229 /* Copied from i386. Doesn't make much sense, because it will
230 only work for pci_alloc_coherent.
231 The caller just has to use GFP_DMA in this case. */
232 if (mask < DMA_BIT_MASK(24))
233 return 0;
234
235 /* Tell the device to use SAC when IOMMU force is on. This 227 /* Tell the device to use SAC when IOMMU force is on. This
236 allows the driver to use cheaper accesses in some cases. 228 allows the driver to use cheaper accesses in some cases.
237 229
@@ -251,6 +243,17 @@ int x86_dma_supported(struct device *dev, u64 mask)
251 243
252 return 1; 244 return 1;
253} 245}
246EXPORT_SYMBOL(arch_dma_supported);
247
248int x86_dma_supported(struct device *dev, u64 mask)
249{
250 /* Copied from i386. Doesn't make much sense, because it will
251 only work for pci_alloc_coherent.
252 The caller just has to use GFP_DMA in this case. */
253 if (mask < DMA_BIT_MASK(24))
254 return 0;
255 return 1;
256}
254 257
255static int __init pci_iommu_init(void) 258static int __init pci_iommu_init(void)
256{ 259{