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

Commit 311a184a authored by Jayant Shekhar's avatar Jayant Shekhar Committed by Animesh Kishore
Browse files

msm: mdss: Change IOMMU map sequence for splash



Currently PA to VA mapping is not working with existing
sequence. Correct the sequence as below:

- set DOMAIN_ATTR_EARLY_MAP  attr to 1
- attach iommu
- perform mapping
- set DOMAIN_ATTR_EARLY_MAP to 0

Change-Id: Ieabb91cc69641bb41ca5a3ff5783dd55385490e6
Signed-off-by: default avatarJayant Shekhar <jshekhar@codeaurora.org>
parent 8f3515e7
Loading
Loading
Loading
Loading
+29 −16
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ static int mdss_mdp_splash_iommu_attach(struct msm_fb_data_type *mfd)
{
	struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	int rc, ret;
	int ret;

	/*
	 * iommu dynamic attach for following conditions.
@@ -166,26 +166,41 @@ static int mdss_mdp_splash_iommu_attach(struct msm_fb_data_type *mfd)
		return -EPERM;
	}

	rc = mdss_smmu_map(MDSS_IOMMU_DOMAIN_UNSECURE,
				mdp5_data->splash_mem_addr,
				mdp5_data->splash_mem_addr,
				mdp5_data->splash_mem_size,
				IOMMU_READ | IOMMU_NOEXEC);
	if (rc) {
		pr_debug("iommu memory mapping failed rc=%d\n", rc);
	} else {
	/*
	 * Putting handoff pending to false to ensure smmu attach happens
	 * with early flag attribute
	 */
	mdata->handoff_pending = false;

	ret = mdss_smmu_set_attribute(MDSS_IOMMU_DOMAIN_UNSECURE, EARLY_MAP, 1);
	if (ret) {
		pr_debug("mdss set attribute failed for early map\n");
		goto end;
	}

	ret = mdss_iommu_ctrl(1);
	if (IS_ERR_VALUE((unsigned long)ret)) {
		pr_err("mdss iommu attach failed\n");
			mdss_smmu_unmap(MDSS_IOMMU_DOMAIN_UNSECURE,
		goto end;
	}

	ret = mdss_smmu_map(MDSS_IOMMU_DOMAIN_UNSECURE,
				mdp5_data->splash_mem_addr,
					mdp5_data->splash_mem_size);
				mdp5_data->splash_mem_addr,
				mdp5_data->splash_mem_size,
				IOMMU_READ | IOMMU_NOEXEC);
	if (ret) {
		pr_err("iommu memory mapping failed ret=%d\n", ret);
	} else {
		pr_debug("iommu map passed for PA=VA\n");
		mfd->splash_info.iommu_dynamic_attached = true;
	}
	}

	return rc;
	ret = mdss_smmu_set_attribute(MDSS_IOMMU_DOMAIN_UNSECURE, EARLY_MAP, 0);
end:
	mdata->handoff_pending = true;

	return ret;
}

static void mdss_mdp_splash_unmap_splash_mem(struct msm_fb_data_type *mfd)
@@ -193,12 +208,10 @@ static void mdss_mdp_splash_unmap_splash_mem(struct msm_fb_data_type *mfd)
	struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);

	if (mfd->splash_info.iommu_dynamic_attached) {

		mdss_smmu_unmap(MDSS_IOMMU_DOMAIN_UNSECURE,
				mdp5_data->splash_mem_addr,
				mdp5_data->splash_mem_size);
		mdss_iommu_ctrl(0);

		mfd->splash_info.iommu_dynamic_attached = false;
	}
}
+21 −0
Original line number Diff line number Diff line
@@ -180,6 +180,27 @@ static int mdss_smmu_enable_power(struct mdss_smmu_client *mdss_smmu,
	return rc;
}

int mdss_smmu_set_attribute(int domain, int flag, int val)
{
	int rc = 0, domain_attr = 0;
	struct mdss_smmu_client *mdss_smmu = mdss_smmu_get_cb(domain);

	if (!mdss_smmu) {
		pr_err("not able to get smmu context\n");
		return -EINVAL;
	}

	if (flag == EARLY_MAP)
		domain_attr = DOMAIN_ATTR_EARLY_MAP;
	else
		goto end;

	rc = iommu_domain_set_attr(mdss_smmu->mmu_mapping->domain,
			domain_attr, &val);
end:
	return rc;
}

/*
 * mdss_smmu_v2_attach()
 *
+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@ struct mdss_smmu_domain {

void mdss_smmu_register(struct device *dev);
int mdss_smmu_init(struct mdss_data_type *mdata, struct device *dev);
int mdss_smmu_set_attribute(int domain, int flag, int val);

enum smmu_attributes {
	EARLY_MAP
};

static inline int mdss_smmu_dma_data_direction(int dir)
{