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

Commit 029f7290 authored by Jeremy Gebben's avatar Jeremy Gebben Committed by Shiraz Hashim
Browse files

iommu: msm: add support for DOMAIN_ATTR_CONTEXT_BANK



Add support for DOMAIN_ATTR_CONTEXT_BANK to query the
context bank ID from the msm iommu legacy driver.

Change-Id: I60cc4442803f49051f9d414fed6e6df4e10f08de
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: default avatarShiraz Hashim <shashim@codeaurora.org>
parent e36d88aa
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1534,6 +1534,7 @@ static int msm_iommu_domain_get_attr(struct iommu_domain *domain,
				enum iommu_attr attr, void *data)
{
	struct msm_iommu_priv *priv = domain->priv;
	struct msm_iommu_ctx_drvdata *ctx_drvdata;

	switch (attr) {
	case DOMAIN_ATTR_COHERENT_HTW_DISABLE:
@@ -1542,6 +1543,14 @@ static int msm_iommu_domain_get_attr(struct iommu_domain *domain,
	case DOMAIN_ATTR_PT_BASE_ADDR:
		*((phys_addr_t *)data) = virt_to_phys(priv->pt.fl_table);
		break;
	case DOMAIN_ATTR_CONTEXT_BANK:
		if (list_empty(&priv->list_attached))
			return -ENODEV;

		ctx_drvdata = list_first_entry(&priv->list_attached,
			struct msm_iommu_ctx_drvdata, attached_elm);
		*((unsigned int *) data) = ctx_drvdata->num;
		break;
	default:
		return -EINVAL;
	}
+22 −0
Original line number Diff line number Diff line
@@ -1009,6 +1009,27 @@ static int msm_iommu_dma_supported(struct iommu_domain *domain,
	return ((1ULL << 32) - 1) < mask ? 0 : 1;
}

static int msm_iommu_domain_get_attr(struct iommu_domain *domain,
				enum iommu_attr attr, void *data)
{
	struct msm_iommu_priv *priv = domain->priv;
	struct msm_iommu_ctx_drvdata *ctx_drvdata;

	switch (attr) {
	case DOMAIN_ATTR_CONTEXT_BANK:
		if (list_empty(&priv->list_attached))
			return -ENODEV;

		ctx_drvdata = list_first_entry(&priv->list_attached,
			struct msm_iommu_ctx_drvdata, attached_elm);
		*((unsigned int *) data) = ctx_drvdata->num;
		break;
	default:
		return -EINVAL;
	}
	return 0;
}

static struct iommu_ops msm_iommu_ops = {
	.domain_init = msm_iommu_domain_init,
	.domain_destroy = msm_iommu_domain_destroy,
@@ -1022,6 +1043,7 @@ static struct iommu_ops msm_iommu_ops = {
	.iova_to_phys = msm_iommu_iova_to_phys,
	.capable = msm_iommu_capable,
	.pgsize_bitmap = MSM_IOMMU_PGSIZES,
	.domain_get_attr = msm_iommu_domain_get_attr,
	.dma_supported = msm_iommu_dma_supported,
};