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

Commit 390346a9 authored by Veera Sundaram Sankaran's avatar Veera Sundaram Sankaran
Browse files

msm: sde: parse IOMMU SIDs from the device tree



Parse the SIDs from device tree and pass the correct
secure SID during scm_call. This removes the hard-coding
of SIDs. Remove unnecessary ifdef check on secure camera
preview VMID.

Change-Id: I92d1abc2d289cbaf4d39b618e07efff144616ba0
Signed-off-by: default avatarVeera Sundaram Sankaran <veeras@codeaurora.org>
parent 14416b24
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@ struct sde_smmu_client {
	struct reg_bus_client *reg_bus_clt;
	bool domain_attached;
	int domain;
	u32 sid;
};

/*
+14 −13
Original line number Diff line number Diff line
@@ -45,18 +45,12 @@
/* Rotator device id to be used in SCM call */
#define SDE_ROTATOR_DEVICE	21

#ifndef VMID_CP_CAMERA_PREVIEW
#define VMID_CP_CAMERA_PREVIEW	VMID_INVAL
#endif

/* SCM call function id to be used for switching between secure and non
/*
 * SCM call function id to be used for switching between secure and non
 * secure context
 */
#define MEM_PROTECT_SD_CTRL_SWITCH 0x18

/* Rotator secure SID */
#define SDE_ROTATOR_SECURE_SID  0xe01

/* waiting for hw time out, 3 vsync for 30fps*/
#define ROT_HW_ACQUIRE_TIMEOUT_IN_MS 100

@@ -601,7 +595,7 @@ static int sde_rotator_secure_session_ctrl(bool enable)

	if (test_bit(SDE_CAPS_SEC_ATTACH_DETACH_SMMU,
		mdata->sde_caps_map)) {
		sid_info = SDE_ROTATOR_SECURE_SID;
		sid_info = mdata->sde_smmu[SDE_IOMMU_DOMAIN_ROT_SECURE].sid;
		desc.arginfo = SCM_ARGS(4, SCM_VAL, SCM_RW, SCM_VAL, SCM_VAL);
		desc.args[0] = SDE_ROTATOR_DEVICE;
		desc.args[1] = SCM_BUFFER_PHYS(&sid_info);
@@ -631,9 +625,12 @@ static int sde_rotator_secure_session_ctrl(bool enable)
				return -EINVAL;
			}

			SDEROT_DBG("scm_call(1) ret=%d, resp=%x",
			SDEROT_DBG(
			  "scm(1) sid0x%x dev0x%llx vmid0x%llx ret%d resp%x\n",
				sid_info, desc.args[0], desc.args[3],
				ret, resp);
			SDEROT_EVTLOG(1, sid_info, desc.args[0], desc.args[3],
					ret, resp);
			SDEROT_EVTLOG(1);
		} else if (mdata->sec_cam_en && !enable) {
			/*
			 * Disable secure camera operation
@@ -648,12 +645,16 @@ static int sde_rotator_secure_session_ctrl(bool enable)
				MEM_PROTECT_SD_CTRL_SWITCH), &desc);
			resp = desc.ret[0];

			SDEROT_DBG("scm_call(0): ret=%d, resp=%x",
			SDEROT_DBG(
			  "scm(0) sid0x%x dev0x%llx vmid0x%llx ret%d resp%d\n",
				sid_info, desc.args[0], desc.args[3],
				ret, resp);

			/* force smmu to reattach */
			sde_smmu_secure_ctrl(1);
			SDEROT_EVTLOG(0);

			SDEROT_EVTLOG(0, sid_info, desc.args[0], desc.args[3],
					ret, resp);
		}
	} else {
		return 0;
+7 −0
Original line number Diff line number Diff line
@@ -517,6 +517,7 @@ int sde_smmu_probe(struct platform_device *pdev)
	const struct of_device_id *match;
	struct sde_module_power *mp;
	char name[MAX_CLIENT_NAME_LEN];
	u32 sid = 0;

	if (!mdata) {
		SDEROT_INFO(
@@ -538,6 +539,11 @@ int sde_smmu_probe(struct platform_device *pdev)

	if (of_find_property(pdev->dev.of_node, "iommus", NULL)) {
		dev = &pdev->dev;
		rc = of_property_read_u32_index(pdev->dev.of_node, "iommus",
			1, &sid);
		if (rc)
			SDEROT_DBG("SID not defined for domain:%d",
					smmu_domain.domain);
	} else {
		SDEROT_ERR("Invalid SMMU ctx for domain:%d\n",
				smmu_domain.domain);
@@ -546,6 +552,7 @@ int sde_smmu_probe(struct platform_device *pdev)

	sde_smmu = &mdata->sde_smmu[smmu_domain.domain];
	sde_smmu->domain = smmu_domain.domain;
	sde_smmu->sid = sid;
	mp = &sde_smmu->mp;
	memset(mp, 0, sizeof(struct sde_module_power));