Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125609
b: refs/heads/master
c: 355bf55
h: refs/heads/master
i:
  125607: cec74de
v: v3
  • Loading branch information
Joerg Roedel committed Jan 3, 2009
1 parent 3ce4252 commit 0fda302
Show file tree
Hide file tree
Showing 2 changed files with 40 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: f1179dc005ee2b0e55c3f74f3552c3e9ef852265
refs/heads/master: 355bf553edb7fe21ada51f62c849180bec6da877
39 changes: 39 additions & 0 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,45 @@ static void attach_device(struct amd_iommu *iommu,
iommu_queue_inv_dev_entry(iommu, devid);
}

#ifdef CONFIG_IOMMU_API
/*
* Removes a device from a protection domain (unlocked)
*/
static void __detach_device(struct protection_domain *domain, u16 devid)
{

/* lock domain */
spin_lock(&domain->lock);

/* remove domain from the lookup table */
amd_iommu_pd_table[devid] = NULL;

/* remove entry from the device table seen by the hardware */
amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
amd_iommu_dev_table[devid].data[1] = 0;
amd_iommu_dev_table[devid].data[2] = 0;

/* decrease reference counter */
domain->dev_cnt -= 1;

/* ready */
spin_unlock(&domain->lock);
}

/*
* Removes a device from a protection domain (with devtable_lock held)
*/
static void detach_device(struct protection_domain *domain, u16 devid)
{
unsigned long flags;

/* lock device table */
write_lock_irqsave(&amd_iommu_devtable_lock, flags);
__detach_device(domain, devid);
write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
}
#endif

/*****************************************************************************
*
* The next functions belong to the dma_ops mapping/unmapping code.
Expand Down

0 comments on commit 0fda302

Please sign in to comment.