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

Commit 10bb4a94 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: Change IOMMU map sequence during splash cleanup"

parents c2841e62 24503116
Loading
Loading
Loading
Loading
+30 −17
Original line number Diff line number Diff line
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 2017, 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
@@ -150,7 +150,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.
@@ -167,26 +167,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(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)
@@ -194,12 +209,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
@@ -280,6 +280,27 @@ end:
	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_attach_v2()
 *
+5 −0
Original line number Diff line number Diff line
@@ -48,6 +48,11 @@ struct mdss_smmu_private {

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)
{