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

Commit 91f10380 authored by David Dai's avatar David Dai
Browse files

msm: msm_bus: Shrink number of batches sent to Rpmh



Rather than batching BCM requests based on VCD, reduce
the number of batches by fitting the highest amount of
requests per batch without ungrouping the requests from
the same VCD. This should help to reduce congestion
from clients requests that span multiple VCDs and
help maintain priority within one batch.

Change-Id: Ie84458f8846772848e6d7f3f60cbc0e0cd3eaa65
Signed-off-by: default avatarDavid Dai <daidavid1@codeaurora.org>
parent 90e4b68f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -450,6 +450,23 @@ static int bcm_clist_add(struct msm_bus_node_device_type *cur_dev)
	return ret;
}

static void tcs_cmd_n_shrink(int *n)
{
	int i = 0, j = 0, sum = 0;

	do {
		if (sum + n[i] > MAX_RPMH_PAYLOAD) {
			n[j] = sum;
			sum = 0;
			j++;
		}
		sum += n[i];
	} while (n[i++]);

	n[j] = sum;
	n[j+1] = 0;
}

static int bcm_query_list_add(struct msm_bus_node_device_type *cur_dev)
{
	int ret = 0;
@@ -591,6 +608,10 @@ int msm_bus_commit_data(struct list_head *clist)
	bcm_cnt = tcs_cmd_list_gen(n_active, n_wake, n_sleep, cmdlist_active,
				cmdlist_wake, cmdlist_sleep, cur_bcm_clist);

	tcs_cmd_n_shrink(n_active);
	tcs_cmd_n_shrink(n_wake);
	tcs_cmd_n_shrink(n_sleep);

	ret = rpmh_invalidate(cur_mbox);
	if (ret)
		MSM_BUS_ERR("%s: Error invalidating mbox: %d\n",