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

Commit dc979af5 authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu Committed by Gerrit - the friendly Code Review server
Browse files

msm: adsprpc: Separate hyp_assign call for audio remote heap protection



Enable audio remote heap protection for separate hyp_assign call to map
HLOS buffer to ADSP_Q6_ELF VM.

Change-Id: I91a70cb8ef2c2feb2d4c398c15c220c78c96a509
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent bb7cc76a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ Required properties:

Optional properties:
- qcom,fastrpc-glink:	Flag to use glink instead of smd for IPC
- qcom,fastrpc-vmid-heap-shared:  Flag for Dynamic heap feature, to
                                  share HLOS memory buffer to ADSP

Optional subnodes:
- qcom,msm_fastrpc_compute_cb :	Child nodes representing the compute context
@@ -25,6 +27,7 @@ Example:
	qcom,msm_fastrpc {
		compatible = "qcom,msm-fastrpc-adsp";
		qcom,fastrpc-glink;
		qcom,fastrpc-vmid-heap-shared;

		qcom,msm_fastrpc_compute_cb_1 {
			compatible = "qcom,msm-fastrpc-compute-cb";
+12 −3
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@
#define FASTRPC_ENOSUCH 39
#define VMID_SSC_Q6     5
#define VMID_ADSP_Q6    6
#define AC_VM_ADSP_HEAP_SHARED 33
#define DEBUGFS_SIZE 1024

#define RPC_TIMEOUT	(5 * HZ)
@@ -222,6 +223,7 @@ struct fastrpc_channel_ctx {
	int prevssrcount;
	int issubsystemup;
	int vmid;
	int heap_vmid;
	int ramdumpenabled;
	void *remoteheap_ramdump_dev;
	struct fastrpc_glink_info link;
@@ -1594,7 +1596,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl,
	struct fastrpc_mmap *file = 0, *mem = 0;
	char *proc_name = NULL;
	int srcVM[1] = {VMID_HLOS};
	int destVM[1] = {VMID_ADSP_Q6};
	int destVM[1] = {gcinfo[0].heap_vmid};
	int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};
	int hlosVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};

@@ -1853,7 +1855,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
	} else if (flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {

		int srcVM[1] = {VMID_HLOS};
		int destVM[1] = {VMID_ADSP_Q6};
		int destVM[1] = {gcinfo[0].heap_vmid};
		int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};

		VERIFY(err, !hyp_assign_phys(map->phys, (uint64_t)map->size,
@@ -1869,7 +1871,7 @@ static int fastrpc_munmap_on_dsp_rh(struct fastrpc_file *fl,
				 struct fastrpc_mmap *map)
{
	int err = 0;
	int srcVM[1] = {VMID_ADSP_Q6};
	int srcVM[1] = {gcinfo[0].heap_vmid};
	int destVM[1] = {VMID_HLOS};
	int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};

@@ -2843,6 +2845,7 @@ static int fastrpc_cb_probe(struct device *dev)
	chan->sesscount++;
	debugfs_global_file = debugfs_create_file("global", 0644, debugfs_root,
							NULL, &debugfs_fops);

bail:
	return err;
}
@@ -2956,6 +2959,12 @@ static int fastrpc_probe(struct platform_device *pdev)
		}
		return 0;
	}
	if (of_property_read_bool(dev->of_node,
					"qcom,fastrpc-vmid-heap-shared"))
		gcinfo[0].heap_vmid = AC_VM_ADSP_HEAP_SHARED;
	else
		gcinfo[0].heap_vmid = VMID_ADSP_Q6;
	pr_info("ADSPRPC: gcinfo[0].heap_vmid %d\n", gcinfo[0].heap_vmid);
	me->glink = of_property_read_bool(dev->of_node, "qcom,fastrpc-glink");
	VERIFY(err, !of_platform_populate(pdev->dev.of_node,
					  fastrpc_match_table,