#define IDENTMAP_GFX 2
#define IDENTMAP_AZALIA 4
-static DEFINE_SPINLOCK(device_domain_lock);
const struct iommu_ops intel_iommu_ops;
static bool translation_pre_enabled(struct intel_iommu *iommu)
struct device_domain_info *info;
int nid = NUMA_NO_NODE;
- spin_lock(&device_domain_lock);
+ spin_lock(&domain->lock);
list_for_each_entry(info, &domain->devices, link) {
/*
* There could possibly be multiple device numa nodes as devices
if (nid != NUMA_NO_NODE)
break;
}
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
return nid;
}
if (!iommu->qi)
return NULL;
- spin_lock(&device_domain_lock);
+ spin_lock(&domain->lock);
list_for_each_entry(info, &domain->devices, link) {
if (info->iommu == iommu && info->bus == bus &&
info->devfn == devfn) {
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
return info->ats_supported ? info : NULL;
}
}
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
return NULL;
}
struct device_domain_info *info;
bool has_iotlb_device = false;
- spin_lock(&device_domain_lock);
+ spin_lock(&domain->lock);
list_for_each_entry(info, &domain->devices, link) {
if (info->ats_enabled) {
has_iotlb_device = true;
}
}
domain->has_iotlb_device = has_iotlb_device;
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
}
static void iommu_enable_dev_iotlb(struct device_domain_info *info)
if (!domain->has_iotlb_device)
return;
- spin_lock(&device_domain_lock);
+ spin_lock(&domain->lock);
list_for_each_entry(info, &domain->devices, link)
__iommu_flush_dev_iotlb(info, addr, mask);
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
}
static void iommu_flush_iotlb_psi(struct intel_iommu *iommu,
domain->flags |= DOMAIN_FLAG_USE_FIRST_LEVEL;
domain->has_iotlb_device = false;
INIT_LIST_HEAD(&domain->devices);
+ spin_lock_init(&domain->lock);
return domain;
}
if (ret)
return ret;
info->domain = domain;
- spin_lock(&device_domain_lock);
+ spin_lock(&domain->lock);
list_add(&info->link, &domain->devices);
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
/* PASID table is mandatory for a PCI device in scalable mode. */
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
static void dmar_remove_one_dev_info(struct device *dev)
{
struct device_domain_info *info = dev_iommu_priv_get(dev);
+ struct dmar_domain *domain = info->domain;
struct intel_iommu *iommu = info->iommu;
if (!dev_is_real_dma_subdevice(info->dev)) {
intel_pasid_free_table(info->dev);
}
- spin_lock(&device_domain_lock);
+ spin_lock(&domain->lock);
list_del(&info->link);
- spin_unlock(&device_domain_lock);
+ spin_unlock(&domain->lock);
- domain_detach_iommu(info->domain, iommu);
+ domain_detach_iommu(domain, iommu);
info->domain = NULL;
}
struct device_domain_info *info;
bool support = true;
- assert_spin_locked(&device_domain_lock);
+ assert_spin_locked(&domain->lock);
list_for_each_entry(info, &domain->devices, link) {
if (!ecap_sc_support(info->iommu->ecap)) {
support = false;
{
struct device_domain_info *info;
- assert_spin_locked(&device_domain_lock);
-
+ assert_spin_locked(&domain->lock);
/*
* Second level page table supports per-PTE snoop control. The
* iommu_map() interface will handle this by setting SNP bit.
if (dmar_domain->force_snooping)
return true;
- spin_lock(&device_domain_lock);
+ spin_lock(&dmar_domain->lock);
if (!domain_support_force_snooping(dmar_domain)) {
- spin_unlock(&device_domain_lock);
+ spin_unlock(&dmar_domain->lock);
return false;
}
domain_set_force_snooping(dmar_domain);
dmar_domain->force_snooping = true;
- spin_unlock(&device_domain_lock);
+ spin_unlock(&dmar_domain->lock);
return true;
}