Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bef2bfc authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

msm: iommu: add some more convenience domain-finding functions



Some common usage patterns have emerged among users of the MSM IOMMU
driver:

    -> find a group by group name
      `--> find a domain by group

and:

    -> find a group by group name
      `--> find a domain by group
          `--> find domain number by domain

Add some helper functions to make those use cases more convenient and
slightly less error prone.

Change-Id: Iad5f315436d600d960ab900de0beae7bd3904257
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 16103798
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -348,6 +348,24 @@ int msm_find_domain_no(const struct iommu_domain *domain)
}
EXPORT_SYMBOL(msm_find_domain_no);

struct iommu_domain *msm_iommu_domain_find(const char *name)
{
	struct iommu_group *group = iommu_group_find(name);
	if (!group)
		return NULL;
	return iommu_group_get_iommudata(group);
}
EXPORT_SYMBOL(msm_iommu_domain_find);

int msm_iommu_domain_no_find(const char *name)
{
	struct iommu_domain *domain = msm_iommu_domain_find(name);
	if (!domain)
		return -EINVAL;
	return msm_find_domain_no(domain);
}
EXPORT_SYMBOL(msm_iommu_domain_no_find);

static struct msm_iova_data *msm_domain_to_iova_data(struct iommu_domain
						     const *domain)
{
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -92,6 +92,9 @@ extern void msm_iommu_set_client_name(struct iommu_domain *domain,
				      char const *name);
extern struct iommu_domain *msm_get_iommu_domain(int domain_num);
extern int msm_find_domain_no(const struct iommu_domain *domain);
extern struct iommu_domain *msm_iommu_domain_find(const char *name);
extern int msm_iommu_domain_no_find(const char *name);


extern int msm_allocate_iova_address(unsigned int iommu_domain,
					unsigned int partition_no,