Skip to content

Commit 73bcbdc

Browse files
jamessewart-aristajoergroedel
authored andcommitted
iommu/vt-d: Implement apply_resv_region iommu ops entry
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 <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 7423e01 commit 73bcbdc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5549,6 +5549,19 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev)
55495549
return ret;
55505550
}
55515551

5552+
static void intel_iommu_apply_resv_region(struct device *dev,
5553+
struct iommu_domain *domain,
5554+
struct iommu_resv_region *region)
5555+
{
5556+
struct dmar_domain *dmar_domain = to_dmar_domain(domain);
5557+
unsigned long start, end;
5558+
5559+
start = IOVA_PFN(region->start);
5560+
end = IOVA_PFN(region->start + region->length - 1);
5561+
5562+
WARN_ON_ONCE(!reserve_iova(&dmar_domain->iovad, start, end));
5563+
}
5564+
55525565
#ifdef CONFIG_INTEL_IOMMU_SVM
55535566
struct intel_iommu *intel_svm_device_to_iommu(struct device *dev)
55545567
{
@@ -5714,6 +5727,7 @@ const struct iommu_ops intel_iommu_ops = {
57145727
.remove_device = intel_iommu_remove_device,
57155728
.get_resv_regions = intel_iommu_get_resv_regions,
57165729
.put_resv_regions = intel_iommu_put_resv_regions,
5730+
.apply_resv_region = intel_iommu_apply_resv_region,
57175731
.device_group = pci_device_group,
57185732
.dev_has_feat = intel_iommu_dev_has_feat,
57195733
.dev_feat_enabled = intel_iommu_dev_feat_enabled,

0 commit comments

Comments
 (0)