aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-01-26 13:40:53 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2012-07-11 06:15:45 -0400
commit0ff64f80e075ae036a4c80c7d7752b1e07fed792 (patch)
treeac1bbe189cfe6908d0bdceaa3042ddd767b98187 /drivers/iommu
parent0cd76dd13bdd2f7f02a2dc931e808e92b191082f (diff)
iommu/amd: Implement DOMAIN_ATTR_GEOMETRY attribute
Implement the attribute itself and add the code for the AMD IOMMU driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c4
-rw-r--r--drivers/iommu/iommu.c19
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index a2e418cba0ff..259a6beddece 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3069,6 +3069,10 @@ static int amd_iommu_domain_init(struct iommu_domain *dom)
3069 3069
3070 dom->priv = domain; 3070 dom->priv = domain;
3071 3071
3072 dom->geometry.aperture_start = 0;
3073 dom->geometry.aperture_end = ~0ULL;
3074 dom->geometry.force_aperture = true;
3075
3072 return 0; 3076 return 0;
3073 3077
3074out_free: 3078out_free:
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index c39972d8ded3..ed5e0a553ca7 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -348,10 +348,23 @@ EXPORT_SYMBOL_GPL(iommu_device_group);
348int iommu_domain_get_attr(struct iommu_domain *domain, 348int iommu_domain_get_attr(struct iommu_domain *domain,
349 enum iommu_attr attr, void *data) 349 enum iommu_attr attr, void *data)
350{ 350{
351 if (!domain->ops->domain_get_attr) 351 struct iommu_domain_geometry *geometry;
352 return -EINVAL; 352 int ret = 0;
353
354 switch (attr) {
355 case DOMAIN_ATTR_GEOMETRY:
356 geometry = data;
357 *geometry = domain->geometry;
358
359 break;
360 default:
361 if (!domain->ops->domain_get_attr)
362 return -EINVAL;
353 363
354 return domain->ops->domain_get_attr(domain, attr, data); 364 ret = domain->ops->domain_get_attr(domain, attr, data);
365 }
366
367 return ret;
355} 368}
356EXPORT_SYMBOL_GPL(iommu_domain_get_attr); 369EXPORT_SYMBOL_GPL(iommu_domain_get_attr);
357 370