summaryrefslogtreecommitdiff
path: root/drivers/iommu/fsl_pamu_domain.c
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2018-09-19 11:12:57 +0100
committerJoerg Roedel <jroedel@suse.de>2018-09-25 14:54:53 +0200
commit701d8a624a2d5aa7d7efd38800c7c6ab4a4c453c (patch)
treeb14b7ae29159bde7c621580fd71fcb5914330ce7 /drivers/iommu/fsl_pamu_domain.c
parent7adb562c3e90f87b0da196c372afe251ad4ec62e (diff)
iommu: Tidy up window attributes
The external interface to get/set window attributes is already abstracted behind iommu_domain_{get,set}_attr(), so there's no real reason for the internal interface to be different. Since we only have one window-based driver anyway, clean up the core code by just moving the DOMAIN_ATTR_WINDOWS handling directly into the PAMU driver. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/fsl_pamu_domain.c')
-rw-r--r--drivers/iommu/fsl_pamu_domain.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index f089136e9c3f..f83965ee3095 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -818,6 +818,7 @@ static int fsl_pamu_set_domain_attr(struct iommu_domain *domain,
enum iommu_attr attr_type, void *data)
{
struct fsl_dma_domain *dma_domain = to_fsl_dma_domain(domain);
+ u32 *count;
int ret = 0;
switch (attr_type) {
@@ -830,6 +831,15 @@ static int fsl_pamu_set_domain_attr(struct iommu_domain *domain,
case DOMAIN_ATTR_FSL_PAMU_ENABLE:
ret = configure_domain_dma_state(dma_domain, *(int *)data);
break;
+ case DOMAIN_ATTR_WINDOWS:
+ count = data;
+
+ if (domain->ops->domain_set_windows != NULL)
+ ret = domain->ops->domain_set_windows(domain, *count);
+ else
+ ret = -ENODEV;
+
+ break;
default:
pr_debug("Unsupported attribute type\n");
ret = -EINVAL;
@@ -843,6 +853,7 @@ static int fsl_pamu_get_domain_attr(struct iommu_domain *domain,
enum iommu_attr attr_type, void *data)
{
struct fsl_dma_domain *dma_domain = to_fsl_dma_domain(domain);
+ u32 *count;
int ret = 0;
switch (attr_type) {
@@ -856,6 +867,15 @@ static int fsl_pamu_get_domain_attr(struct iommu_domain *domain,
case DOMAIN_ATTR_FSL_PAMUV1:
*(int *)data = DOMAIN_ATTR_FSL_PAMUV1;
break;
+ case DOMAIN_ATTR_WINDOWS:
+ count = data;
+
+ if (domain->ops->domain_get_windows != NULL)
+ *count = domain->ops->domain_get_windows(domain);
+ else
+ ret = -ENODEV;
+
+ break;
default:
pr_debug("Unsupported attribute type\n");
ret = -EINVAL;