|
|
@@ -1929,16 +1929,13 @@ static void do_attach(struct iommu_dev_data *dev_data,
|
|
|
|
|
|
static void do_detach(struct iommu_dev_data *dev_data)
|
|
|
{
|
|
|
+ struct protection_domain *domain = dev_data->domain;
|
|
|
struct amd_iommu *iommu;
|
|
|
u16 alias;
|
|
|
|
|
|
iommu = amd_iommu_rlookup_table[dev_data->devid];
|
|
|
alias = dev_data->alias;
|
|
|
|
|
|
- /* decrease reference counters */
|
|
|
- dev_data->domain->dev_iommu[iommu->index] -= 1;
|
|
|
- dev_data->domain->dev_cnt -= 1;
|
|
|
-
|
|
|
/* Update data structures */
|
|
|
dev_data->domain = NULL;
|
|
|
list_del(&dev_data->list);
|
|
|
@@ -1948,6 +1945,16 @@ static void do_detach(struct iommu_dev_data *dev_data)
|
|
|
|
|
|
/* Flush the DTE entry */
|
|
|
device_flush_dte(dev_data);
|
|
|
+
|
|
|
+ /* Flush IOTLB */
|
|
|
+ domain_flush_tlb_pde(domain);
|
|
|
+
|
|
|
+ /* Wait for the flushes to finish */
|
|
|
+ domain_flush_complete(domain);
|
|
|
+
|
|
|
+ /* decrease reference counters - needs to happen after the flushes */
|
|
|
+ domain->dev_iommu[iommu->index] -= 1;
|
|
|
+ domain->dev_cnt -= 1;
|
|
|
}
|
|
|
|
|
|
/*
|