aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-09-09 12:40:46 -0400
committerIngo Molnar <mingo@elte.hu>2008-09-19 06:59:20 -0400
commitb39ba6ad004a31bf2a08ba2b08c1e0f9b3530bb7 (patch)
tree1d9415db8d47a984692b17d02a3afb365352caa4 /arch/x86
parenta22131a223147016041b5e5cd0ae5ab61ef4177e (diff)
AMD IOMMU: add dma_supported callback
This function determines if the AMD IOMMU implementation is responsible for a given device. So the DMA layer can get this information from the driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/amd_iommu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 0cb8fd2359f5..a6a6f8ed1cf5 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1205,6 +1205,30 @@ free_mem:
1205} 1205}
1206 1206
1207/* 1207/*
1208 * This function is called by the DMA layer to find out if we can handle a
1209 * particular device. It is part of the dma_ops.
1210 */
1211static int amd_iommu_dma_supported(struct device *dev, u64 mask)
1212{
1213 u16 bdf;
1214 struct pci_dev *pcidev;
1215
1216 /* No device or no PCI device */
1217 if (!dev || dev->bus != &pci_bus_type)
1218 return 0;
1219
1220 pcidev = to_pci_dev(dev);
1221
1222 bdf = calc_devid(pcidev->bus->number, pcidev->devfn);
1223
1224 /* Out of our scope? */
1225 if (bdf > amd_iommu_last_bdf)
1226 return 0;
1227
1228 return 1;
1229}
1230
1231/*
1208 * The function for pre-allocating protection domains. 1232 * The function for pre-allocating protection domains.
1209 * 1233 *
1210 * If the driver core informs the DMA layer if a driver grabs a device 1234 * If the driver core informs the DMA layer if a driver grabs a device
@@ -1247,6 +1271,7 @@ static struct dma_mapping_ops amd_iommu_dma_ops = {
1247 .unmap_single = unmap_single, 1271 .unmap_single = unmap_single,
1248 .map_sg = map_sg, 1272 .map_sg = map_sg,
1249 .unmap_sg = unmap_sg, 1273 .unmap_sg = unmap_sg,
1274 .dma_supported = amd_iommu_dma_supported,
1250}; 1275};
1251 1276
1252/* 1277/*