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

Commit bfb3ef1c authored by Kyle Yan's avatar Kyle Yan Committed by Runmin Wang
Browse files

soc: qcom: pil: Add functionality to send subsystem status to AOP



With new AOP architecture, AOP does not have any knowledge of which
subsystems are online at a given moment. This can lead to issues when
not all the subsystems are loaded as AOP assumes that they are all on
by default and will block system suspend.

AOP should assume most subsystems are not loaded by default and instead
rely upon the PIL driver to indicate when a subsystem is loaded/unloaded.

Change-Id: I7e36c2e4e0404d64df3bd241b1599cf690fe4506
Signed-off-by: default avatarKyle Yan <kyan@codeaurora.org>
parent d92286df
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#endif

#define PIL_NUM_DESC		10
#define MAX_LEN 96
static void __iomem *pil_info_base;

/**
@@ -758,6 +759,23 @@ static int pil_parse_devicetree(struct pil_desc *desc)
	return 0;
}

static int pil_notify_aop(struct pil_desc *desc, char *status)
{
	struct qmp_pkt pkt;
	char mbox_msg[MAX_LEN];

	if (!desc->signal_aop)
		return 0;

	snprintf(mbox_msg, MAX_LEN,
		"{class: image, res: load_state, name: %s, val: %s}",
		desc->name, status);
	pkt.size = MAX_LEN;
	pkt.data = mbox_msg;

	return mbox_send_message(desc->mbox, &pkt);
}

/* Synchronize request_firmware() with suspend */
static DECLARE_RWSEM(pil_pm_rwsem);

@@ -779,6 +797,12 @@ int pil_boot(struct pil_desc *desc)
	bool mem_protect = false;
	bool hyp_assign = false;

	ret = pil_notify_aop(desc, "on");
	if (ret < 0) {
		pil_err(desc, "Failed to send ON message to AOP rc:%d\n", ret);
		return ret;
	}

	if (desc->shutdown_fail)
		pil_err(desc, "Subsystem shutdown failed previously!\n");

@@ -937,6 +961,7 @@ int pil_boot(struct pil_desc *desc)
			priv->region = NULL;
		}
		pil_release_mmap(desc);
		pil_notify_aop(desc, "off");
	}
	return ret;
}
@@ -948,6 +973,7 @@ EXPORT_SYMBOL(pil_boot);
 */
void pil_shutdown(struct pil_desc *desc)
{
	int ret;
	struct pil_priv *priv = desc->priv;

	if (desc->ops->shutdown) {
@@ -965,6 +991,9 @@ void pil_shutdown(struct pil_desc *desc)
		pil_proxy_unvote(desc, 1);
	else
		flush_delayed_work(&priv->proxy);
	ret = pil_notify_aop(desc, "off");
	if (ret < 0)
		pr_warn("pil: failed to send OFF message to AOP rc:%d\n", ret);
	desc->modem_ssr = true;
}
EXPORT_SYMBOL(pil_shutdown);
+6 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@
#ifndef __MSM_PERIPHERAL_LOADER_H
#define __MSM_PERIPHERAL_LOADER_H

#include <linux/mailbox_client.h>
#include <linux/mailbox/qmp.h>

struct device;
struct module;
struct pil_priv;
@@ -57,6 +60,9 @@ struct pil_desc {
	bool modem_ssr;
	bool clear_fw_region;
	u32 subsys_vmid;
	bool signal_aop;
	struct mbox_client cl;
	struct mbox_chan *mbox;
};

/**
+16 −0
Original line number Diff line number Diff line
@@ -1144,6 +1144,22 @@ static int pil_tz_driver_probe(struct platform_device *pdev)
		d->subsys_desc.ramdump_disable_handler =
			subsys_ramdump_disable_intr_handler;
	}
	d->desc.signal_aop = of_property_read_bool(pdev->dev.of_node,
						"qcom,signal-aop");
	if (d->desc.signal_aop) {
		d->desc.cl.dev = &pdev->dev;
		d->desc.cl.tx_block = true;
		d->desc.cl.tx_tout = 1000;
		d->desc.cl.knows_txdone = false;
		d->desc.mbox = mbox_request_channel(&d->desc.cl, 0);
		if (IS_ERR(d->desc.mbox)) {
			rc = PTR_ERR(d->desc.mbox);
			dev_err(&pdev->dev, "Failed to get mailbox channel %pK %d\n",
				d->desc.mbox, rc);
			goto err_ramdump;
		}
	}

	d->ramdump_dev = create_ramdump_device(d->subsys_desc.name,
								&pdev->dev);
	if (!d->ramdump_dev) {