Skip to content

Commit

Permalink
iommu/amd: Use default domain if available for DMA-API
Browse files Browse the repository at this point in the history
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Joerg Roedel committed Jun 11, 2015
1 parent 35cf248 commit 063071d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2495,12 +2495,19 @@ void amd_iommu_init_notifier(void)
static struct protection_domain *get_domain(struct device *dev)
{
struct protection_domain *domain;
struct iommu_domain *io_domain;
struct dma_ops_domain *dma_dom;
u16 devid = get_device_id(dev);

if (!check_device(dev))
return ERR_PTR(-EINVAL);

io_domain = iommu_get_domain_for_dev(dev);
if (io_domain) {
domain = to_pdomain(io_domain);
return domain;
}

domain = domain_for_device(dev);
if (domain != NULL && !dma_ops_domain(domain))
return ERR_PTR(-EBUSY);
Expand Down

0 comments on commit 063071d

Please sign in to comment.