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

Commit 64834df7 authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: mailbox: relax CPU to allow interrupt handlers to run



When the RPMH communication is extremely stressed, the interrupt
handlers do not get a chance to run and free the TCS, because the
requests are the holding the spin lock (which disables the interrupts)
and spin while waiting for a free TCS to write to. Instead, return from
the controller so that control goes back to the mailbox framework that
releases the spin lock, allowing the interrupt handlers to run before
retrying again.

Also, reduce the verbosity of the messages in retrying. The excessive
messages themselves add to the cause.

Change-Id: Ib37122a95c0424a02d05512a28f4d94e43a783c9
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 191ff2f4
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -852,7 +852,6 @@ static int chan_tcs_write(struct mbox_chan *chan, void *data)
	struct tcs_mbox_msg *msg = data;
	const struct device *dev = chan->cl->dev;
	int ret = 0;
	int count = 0;

	if (!msg) {
		dev_err(dev, "Payload error\n");
@@ -894,12 +893,7 @@ static int chan_tcs_write(struct mbox_chan *chan, void *data)
		tcs_mbox_invalidate(chan);

	/* Post the message to the TCS and trigger */
	do {
	ret = tcs_mbox_write(chan, msg, true);
		if (ret != -EBUSY)
			break;
		udelay(100);
	} while (++count < 100);

tx_fail:
	/* If there was an error in the request, schedule a response */
@@ -915,7 +909,7 @@ static int chan_tcs_write(struct mbox_chan *chan, void *data)

	/* If we were just busy waiting for TCS, dump the state and return */
	if (ret == -EBUSY) {
		dev_err(dev, "TCS Busy, retrying RPMH message send\n");
		pr_info("TCS Busy, retrying RPMH message send\n");
		dump_tcs_stats(drv);
		ret = -EAGAIN;
	}