Skip to content

Commit

Permalink
iommu/vt-d: Implement apply_resv_region iommu ops entry
Browse files Browse the repository at this point in the history
Used by iommu.c before creating identity mappings for reserved
ranges to ensure dma-ops won't ever remap these ranges.

Signed-off-by: James Sewart <jamessewart@arista.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
James Sewart authored and Joerg Roedel committed May 27, 2019
1 parent 7423e01 commit 73bcbdc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5549,6 +5549,19 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev)
return ret;
}

static void intel_iommu_apply_resv_region(struct device *dev,
struct iommu_domain *domain,
struct iommu_resv_region *region)
{
struct dmar_domain *dmar_domain = to_dmar_domain(domain);
unsigned long start, end;

start = IOVA_PFN(region->start);
end = IOVA_PFN(region->start + region->length - 1);

WARN_ON_ONCE(!reserve_iova(&dmar_domain->iovad, start, end));
}

#ifdef CONFIG_INTEL_IOMMU_SVM
struct intel_iommu *intel_svm_device_to_iommu(struct device *dev)
{
Expand Down Expand Up @@ -5714,6 +5727,7 @@ const struct iommu_ops intel_iommu_ops = {
.remove_device = intel_iommu_remove_device,
.get_resv_regions = intel_iommu_get_resv_regions,
.put_resv_regions = intel_iommu_put_resv_regions,
.apply_resv_region = intel_iommu_apply_resv_region,
.device_group = pci_device_group,
.dev_has_feat = intel_iommu_dev_has_feat,
.dev_feat_enabled = intel_iommu_dev_feat_enabled,
Expand Down

0 comments on commit 73bcbdc

Please sign in to comment.