···233233 unsigned long bus;234234 phys_addr_t paddr = page_to_phys(page) + offset;235235236236- if (!dev)237237- dev = &x86_dma_fallback_dev;238238-239236 if (!need_iommu(dev, paddr, size))240237 return paddr;241238···388391389392 if (nents == 0)390393 return 0;391391-392392- if (!dev)393393- dev = &x86_dma_fallback_dev;394394395395 out = 0;396396 start = 0;
-20
arch/x86/kernel/pci-dma.c
···51515252extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];53535454-/* Dummy device used for NULL arguments (normally ISA). */5555-struct device x86_dma_fallback_dev = {5656- .init_name = "fallback device",5757- .coherent_dma_mask = ISA_DMA_BIT_MASK,5858- .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,5959-};6060-EXPORT_SYMBOL(x86_dma_fallback_dev);6161-6254void __init pci_iommu_alloc(void)6355{6456 struct iommu_table_entry *p;···6876 }6977 }7078}7171-7272-bool arch_dma_alloc_attrs(struct device **dev)7373-{7474- if (!*dev)7575- *dev = &x86_dma_fallback_dev;7676-7777- if (!is_device_dma_capable(*dev))7878- return false;7979- return true;8080-8181-}8282-EXPORT_SYMBOL(arch_dma_alloc_attrs);83798480/*8581 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
-7
kernel/dma/mapping.c
···238238}239239EXPORT_SYMBOL_GPL(dma_get_required_mask);240240241241-#ifndef arch_dma_alloc_attrs242242-#define arch_dma_alloc_attrs(dev) (true)243243-#endif244244-245241void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,246242 gfp_t flag, unsigned long attrs)247243{···251255252256 /* let the implementation decide on the zone to allocate from: */253257 flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);254254-255255- if (!arch_dma_alloc_attrs(&dev))256256- return NULL;257258258259 if (dma_is_direct(ops))259260 cpu_addr = dma_direct_alloc(dev, size, dma_handle, flag, attrs);