Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112605
b: refs/heads/master
c: b39ba6a
h: refs/heads/master
i:
  112603: b289c6b
v: v3
  • Loading branch information
Joerg Roedel authored and Ingo Molnar committed Sep 19, 2008
1 parent d7e80c7 commit a663068
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a22131a223147016041b5e5cd0ae5ab61ef4177e
refs/heads/master: b39ba6ad004a31bf2a08ba2b08c1e0f9b3530bb7
25 changes: 25 additions & 0 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,30 @@ static void free_coherent(struct device *dev, size_t size,
free_pages((unsigned long)virt_addr, get_order(size));
}

/*
* This function is called by the DMA layer to find out if we can handle a
* particular device. It is part of the dma_ops.
*/
static int amd_iommu_dma_supported(struct device *dev, u64 mask)
{
u16 bdf;
struct pci_dev *pcidev;

/* No device or no PCI device */
if (!dev || dev->bus != &pci_bus_type)
return 0;

pcidev = to_pci_dev(dev);

bdf = calc_devid(pcidev->bus->number, pcidev->devfn);

/* Out of our scope? */
if (bdf > amd_iommu_last_bdf)
return 0;

return 1;
}

/*
* The function for pre-allocating protection domains.
*
Expand Down Expand Up @@ -1247,6 +1271,7 @@ static struct dma_mapping_ops amd_iommu_dma_ops = {
.unmap_single = unmap_single,
.map_sg = map_sg,
.unmap_sg = unmap_sg,
.dma_supported = amd_iommu_dma_supported,
};

/*
Expand Down

0 comments on commit a663068

Please sign in to comment.