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

Commit 9f58b600 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "adsprpc: set QoS only to silver cluster"

parents 2178bbdb b2f356cc
Loading
Loading
Loading
Loading
+51 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@
#include <linux/debugfs.h>
#include <linux/debugfs.h>
#include <linux/pm_qos.h>
#include <linux/pm_qos.h>
#include <linux/stat.h>
#include <linux/stat.h>
#include <linux/cpumask.h>


#define CREATE_TRACE_POINTS
#define CREATE_TRACE_POINTS
#include <trace/events/fastrpc.h>
#include <trace/events/fastrpc.h>
@@ -224,6 +225,11 @@ struct secure_vm {
	int vmcount;
	int vmcount;
};
};


struct qos_cores {
	int *coreno;
	int corecount;
};

struct fastrpc_file;
struct fastrpc_file;


struct fastrpc_buf {
struct fastrpc_buf {
@@ -370,6 +376,7 @@ struct fastrpc_apps {
	/* Unique job id for each message */
	/* Unique job id for each message */
	uint64_t jobid[NUM_CHANNELS];
	uint64_t jobid[NUM_CHANNELS];
	struct wakeup_source *wake_source;
	struct wakeup_source *wake_source;
	struct qos_cores silvercores;
};
};


struct fastrpc_mmap {
struct fastrpc_mmap {
@@ -3954,6 +3961,9 @@ static int fastrpc_internal_control(struct fastrpc_file *fl,
{
{
	int err = 0;
	int err = 0;
	unsigned int latency;
	unsigned int latency;
	cpumask_t mask;
	struct fastrpc_apps *me = &gfa;
	u32 len = me->silvercores.corecount, i = 0;


	VERIFY(err, !IS_ERR_OR_NULL(fl) && !IS_ERR_OR_NULL(fl->apps));
	VERIFY(err, !IS_ERR_OR_NULL(fl) && !IS_ERR_OR_NULL(fl->apps));
	if (err)
	if (err)
@@ -3969,6 +3979,12 @@ static int fastrpc_internal_control(struct fastrpc_file *fl,
		VERIFY(err, latency != 0);
		VERIFY(err, latency != 0);
		if (err)
		if (err)
			goto bail;
			goto bail;
		cpumask_clear(&mask);
		for (i = 0; i < len; i++)
			cpumask_set_cpu(me->silvercores.coreno[i], &mask);
		fl->pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
		cpumask_copy(&fl->pm_qos_req.cpus_affine, &mask);

		if (!fl->qos_request) {
		if (!fl->qos_request) {
			pm_qos_add_request(&fl->pm_qos_req,
			pm_qos_add_request(&fl->pm_qos_req,
				PM_QOS_CPU_DMA_LATENCY, latency);
				PM_QOS_CPU_DMA_LATENCY, latency);
@@ -4580,6 +4596,39 @@ static void init_secure_vmid_list(struct device *dev, char *prop_name,
	}
	}
}
}


static void init_qos_cores_list(struct device *dev, char *prop_name,
						struct qos_cores *silvercores)
{
	int err = 0;
	u32 len = 0, i = 0;
	u32 *coreslist = NULL;

	if (!of_find_property(dev->of_node, prop_name, &len))
		goto bail;
	if (len == 0)
		goto bail;
	len /= sizeof(u32);
	VERIFY(err, NULL != (coreslist = kcalloc(len, sizeof(u32),
						 GFP_KERNEL)));
	if (err)
		goto bail;
	for (i = 0; i < len; i++) {
		err = of_property_read_u32_index(dev->of_node, prop_name, i,
								&coreslist[i]);
		if (err) {
			pr_err("adsprpc: %s: failed to read QOS cores list\n",
								 __func__);
			goto bail;
		}
	}
	silvercores->coreno = coreslist;
	silvercores->corecount = len;
bail:
	if (err) {
		kfree(coreslist);
	}
}

static void configure_secure_channels(uint32_t secure_domains)
static void configure_secure_channels(uint32_t secure_domains)
{
{
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_apps *me = &gfa;
@@ -4617,6 +4666,8 @@ static int fastrpc_probe(struct platform_device *pdev)
					"qcom,msm-fastrpc-compute")) {
					"qcom,msm-fastrpc-compute")) {
		init_secure_vmid_list(dev, "qcom,adsp-remoteheap-vmid",
		init_secure_vmid_list(dev, "qcom,adsp-remoteheap-vmid",
							&gcinfo[0].rhvm);
							&gcinfo[0].rhvm);
		init_qos_cores_list(dev, "qcom,qos-cores",
							&me->silvercores);




		of_property_read_u32(dev->of_node, "qcom,rpc-latency-us",
		of_property_read_u32(dev->of_node, "qcom,rpc-latency-us",