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

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

Merge "soc: qcom: pil: Add IPC logging for PIL"

parents 262fc5dc 4dd75a41
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -60,9 +60,20 @@
#define MAX_LEN 96
#define NUM_OF_ENCRYPTED_KEY	3

#define pil_log(msg, desc)	\
	do {			\
		if (pil_ipc_log)		\
			pil_ipc("[%s]: %s", desc->name, msg); \
		else		\
			trace_pil_event(msg, desc);	\
	} while (0)


static void __iomem *pil_info_base;
static struct md_global_toc *g_md_toc;

void *pil_ipc_log;

/**
 * proxy_timeout - Override for proxy vote timeouts
 * -1: Use driver-specified timeout
@@ -1278,7 +1289,7 @@ int pil_boot(struct pil_desc *desc)
		goto release_fw;
	}

	trace_pil_event("before_init_image", desc);
	pil_log("before_init_image", desc);
	if (desc->ops->init_image)
		ret = desc->ops->init_image(desc, fw->data, fw->size);
	if (ret) {
@@ -1286,7 +1297,7 @@ int pil_boot(struct pil_desc *desc)
		goto err_boot;
	}

	trace_pil_event("before_mem_setup", desc);
	pil_log("before_mem_setup", desc);
	if (desc->ops->mem_setup)
		ret = desc->ops->mem_setup(desc, priv->region_start,
				priv->region_end - priv->region_start);
@@ -1302,7 +1313,7 @@ int pil_boot(struct pil_desc *desc)
		 * Also for secure boot devices, modem memory has to be released
		 * after MBA is booted
		 */
		trace_pil_event("before_assign_mem", desc);
		pil_log("before_assign_mem", desc);
		if (desc->modem_ssr) {
			ret = pil_assign_mem_to_linux(desc, priv->region_start,
				(priv->region_end - priv->region_start));
@@ -1321,7 +1332,7 @@ int pil_boot(struct pil_desc *desc)
		hyp_assign = true;
	}

	trace_pil_event("before_load_seg", desc);
	pil_log("before_load_seg", desc);

	/**
	 * Fallback to serial loading of blobs if the
@@ -1340,7 +1351,7 @@ int pil_boot(struct pil_desc *desc)
	}

	if (desc->subsys_vmid > 0) {
		trace_pil_event("before_reclaim_mem", desc);
		pil_log("before_reclaim_mem", desc);
		ret =  pil_reclaim_mem(desc, priv->region_start,
				(priv->region_end - priv->region_start),
				desc->subsys_vmid);
@@ -1352,13 +1363,13 @@ int pil_boot(struct pil_desc *desc)
		hyp_assign = false;
	}

	trace_pil_event("before_auth_reset", desc);
	pil_log("before_auth_reset", desc);
	ret = desc->ops->auth_and_reset(desc);
	if (ret) {
		pil_err(desc, "Failed to bring out of reset(rc:%d)\n", ret);
		goto err_auth_and_reset;
	}
	trace_pil_event("reset_done", desc);
	pil_log("reset_done", desc);
	pil_info(desc, "Brought out of reset\n");
	desc->modem_ssr = false;
err_auth_and_reset:
@@ -1680,6 +1691,9 @@ static int __init msm_pil_init(void)
	if (!pil_wq)
		pr_warn("pil: Defaulting to sequential firmware loading.\n");

	pil_ipc_log = ipc_log_context_create(2, "PIL-IPC", 0);
	if (!pil_ipc_log)
		pr_warn("Failed to setup PIL ipc logging\n");
out:
	return register_pm_notifier(&pil_pm_notifier);
}
+10 −1
Original line number Diff line number Diff line
/* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -15,11 +15,20 @@
#include <linux/mailbox_client.h>
#include <linux/mailbox/qmp.h>
#include "minidump_private.h"
#include <linux/ipc_logging.h>

struct device;
struct module;
struct pil_priv;

extern void *pil_ipc_log;

#define pil_ipc(__msg, ...) \
do { \
	if (pil_ipc_log) \
		ipc_log_string(pil_ipc_log, \
			"[%s]: "__msg, __func__,  ##__VA_ARGS__); \
} while (0)
/**
 * struct pil_desc - PIL descriptor
 * @name: string used for pil_get()
+6 −1
Original line number Diff line number Diff line
@@ -281,6 +281,8 @@ static ssize_t restart_level_store(struct device *dev,

	for (i = 0; i < ARRAY_SIZE(restart_levels); i++)
		if (!strncasecmp(buf, restart_levels[i], count)) {
			pil_ipc("[%s]: change restart level to %d\n",
				subsys->desc->name, i);
			subsys->restart_level = i;
			return orig_count;
		}
@@ -875,7 +877,7 @@ static int subsys_start(struct subsys_device *subsys)
		subsys_set_state(subsys, SUBSYS_ONLINE);
		return 0;
	}

	pil_ipc("[%s]: before wait_for_err_ready\n", subsys->desc->name);
	ret = wait_for_err_ready(subsys);
	if (ret) {
		/* pil-boot succeeded but we need to shutdown
@@ -891,6 +893,7 @@ static int subsys_start(struct subsys_device *subsys)

	notify_each_subsys_device(&subsys, 1, SUBSYS_AFTER_POWERUP,
								NULL);
	pil_ipc("[%s]: exit\n", subsys->desc->name);
	return ret;
}

@@ -898,6 +901,7 @@ static void subsys_stop(struct subsys_device *subsys)
{
	const char *name = subsys->desc->name;

	pil_ipc("[%s]: entry\n", subsys->desc->name);
	notify_each_subsys_device(&subsys, 1, SUBSYS_BEFORE_SHUTDOWN, NULL);
	reinit_completion(&subsys->shutdown_ack);
	if (!of_property_read_bool(subsys->desc->dev->of_node,
@@ -916,6 +920,7 @@ static void subsys_stop(struct subsys_device *subsys)
	subsys_set_state(subsys, SUBSYS_OFFLINE);
	disable_all_irqs(subsys);
	notify_each_subsys_device(&subsys, 1, SUBSYS_AFTER_SHUTDOWN, NULL);
	pil_ipc("[%s]: exit\n", subsys->desc->name);
}

int subsystem_set_fwname(const char *name, const char *fw_name)