x86/amd-iommu: Rename iommu_flush_device

This function operates on a struct device, so give it a name
that represents that. As a side effect a new function is
introduced which operates on am iommu and a device-id. It
will be used again in a later patch.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
Joerg Roedel 2011-04-06 18:51:26 +02:00
parent ac0ea6e92b
commit d8c1308577

View file

@ -530,21 +530,27 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
return wait_on_sem(&sem); return wait_on_sem(&sem);
} }
static int iommu_flush_dte(struct amd_iommu *iommu, u16 devid)
{
struct iommu_cmd cmd;
build_inv_dte(&cmd, devid);
return iommu_queue_command(iommu, &cmd);
}
/* /*
* Command send function for invalidating a device table entry * Command send function for invalidating a device table entry
*/ */
static int iommu_flush_device(struct device *dev) static int device_flush_dte(struct device *dev)
{ {
struct amd_iommu *iommu; struct amd_iommu *iommu;
struct iommu_cmd cmd;
u16 devid; u16 devid;
devid = get_device_id(dev); devid = get_device_id(dev);
iommu = amd_iommu_rlookup_table[devid]; iommu = amd_iommu_rlookup_table[devid];
build_inv_dte(&cmd, devid); return iommu_flush_dte(iommu, devid);
return iommu_queue_command(iommu, &cmd);
} }
/* /*
@ -620,7 +626,7 @@ static void domain_flush_devices(struct protection_domain *domain)
spin_lock_irqsave(&domain->lock, flags); spin_lock_irqsave(&domain->lock, flags);
list_for_each_entry(dev_data, &domain->dev_list, list) list_for_each_entry(dev_data, &domain->dev_list, list)
iommu_flush_device(dev_data->dev); device_flush_dte(dev_data->dev);
spin_unlock_irqrestore(&domain->lock, flags); spin_unlock_irqrestore(&domain->lock, flags);
} }
@ -1424,7 +1430,7 @@ static void do_attach(struct device *dev, struct protection_domain *domain)
domain->dev_cnt += 1; domain->dev_cnt += 1;
/* Flush the DTE entry */ /* Flush the DTE entry */
iommu_flush_device(dev); device_flush_dte(dev);
} }
static void do_detach(struct device *dev) static void do_detach(struct device *dev)
@ -1447,7 +1453,7 @@ static void do_detach(struct device *dev)
clear_dte_entry(devid); clear_dte_entry(devid);
/* Flush the DTE entry */ /* Flush the DTE entry */
iommu_flush_device(dev); device_flush_dte(dev);
} }
/* /*
@ -1663,7 +1669,7 @@ static int device_change_notifier(struct notifier_block *nb,
goto out; goto out;
} }
iommu_flush_device(dev); device_flush_dte(dev);
iommu_completion_wait(iommu); iommu_completion_wait(iommu);
out: out:
@ -2448,7 +2454,7 @@ static void amd_iommu_detach_device(struct iommu_domain *dom,
if (!iommu) if (!iommu)
return; return;
iommu_flush_device(dev); device_flush_dte(dev);
iommu_completion_wait(iommu); iommu_completion_wait(iommu);
} }