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

Commit bb59a2c0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: ipc_router: Add support to disable loading a subsystem"

parents 93ee03fc 57445e0c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ Required properties:

Optional properties:
-qcom,fragmented-data:	Indicate the SMD transport supports fragmented data
-qcom,disable-pil-loading: Disable PIL Loading of the remote subsystem

Example:
	qcom,ipc_router_modem_xprt {
@@ -20,6 +21,7 @@ Example:
		qcom,xprt-linkid = <1>;
		qcom,xprt-version = <1>;
		qcom,fragmented-data;
		qcom,disable-pil-loading;
	};

	qcom,ipc_router_q6_xprt {
+38 −2
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ if (msm_ipc_router_smd_xprt_debug_mask) \
 *                      by IPC Router.
 * @xprt_version: IPC Router header version supported by this XPRT.
 * @xprt_option: XPRT specific options to be handled by IPC Router.
 * @disable_pil_loading: Disable PIL Loading of the subsystem.
 */
struct msm_ipc_router_smd_xprt {
	struct list_head list;
@@ -87,6 +88,7 @@ struct msm_ipc_router_smd_xprt {
	struct completion sft_close_complete;
	unsigned xprt_version;
	unsigned xprt_option;
	bool disable_pil_loading;
};

struct msm_ipc_router_smd_xprt_work {
@@ -105,6 +107,7 @@ static void smd_xprt_close_event(struct work_struct *work);
 * @edge: ID to differentiate among multiple SMD endpoints.
 * @link_id: Network Cluster ID to which this XPRT belongs to.
 * @xprt_version: IPC Router header version supported by this XPRT.
 * @disable_pil_loading: Disable PIL Loading of the subsystem.
 */
struct msm_ipc_router_smd_xprt_config {
	char ch_name[SMD_MAX_CH_NAME_LEN];
@@ -113,6 +116,7 @@ struct msm_ipc_router_smd_xprt_config {
	uint32_t link_id;
	unsigned xprt_version;
	unsigned xprt_option;
	bool disable_pil_loading;
};

struct msm_ipc_router_smd_xprt_config smd_xprt_cfg[] = {
@@ -133,6 +137,8 @@ static void pil_vote_load_worker(struct work_struct *work);
static void pil_vote_unload_worker(struct work_struct *work);
static struct workqueue_struct *pil_vote_wq;

static bool is_pil_loading_disabled(uint32_t edge);

static int msm_ipc_router_smd_get_xprt_version(
	struct msm_ipc_router_xprt *xprt)
{
@@ -442,9 +448,11 @@ static void *msm_ipc_load_subsystem(uint32_t edge)
{
	void *pil = NULL;
	const char *peripheral;
	bool loading_disabled;

	loading_disabled = is_pil_loading_disabled(edge);
	peripheral = smd_edge_to_pil_str(edge);
	if (!IS_ERR_OR_NULL(peripheral)) {
	if (!IS_ERR_OR_NULL(peripheral) && !loading_disabled) {
		pil = subsystem_get(peripheral);
		if (IS_ERR(pil)) {
			IPC_RTR_ERR("%s: Failed to load %s\n",
@@ -481,6 +489,27 @@ static struct msm_ipc_router_smd_xprt *
	return NULL;
}

/**
 * is_pil_loading_disabled() - Check if pil loading a subsystem is disabled
 * @edge: Edge that points to the remote subsystem.
 *
 * @return: true if disabled, false if enabled.
 */
static bool is_pil_loading_disabled(uint32_t edge)
{
	struct msm_ipc_router_smd_xprt *smd_xprtp;

	mutex_lock(&smd_remote_xprt_list_lock_lha1);
	list_for_each_entry(smd_xprtp, &smd_remote_xprt_list, list) {
		if (smd_xprtp->edge == edge) {
			mutex_unlock(&smd_remote_xprt_list_lock_lha1);
			return smd_xprtp->disable_pil_loading;
		}
	}
	mutex_unlock(&smd_remote_xprt_list_lock_lha1);
	return true;
}

/**
 * msm_ipc_router_smd_remote_probe() - Probe an SMD endpoint
 *
@@ -559,11 +588,14 @@ static void pil_vote_load_worker(struct work_struct *work)
{
	const char *peripheral;
	struct pil_vote_info *vote_info;
	bool loading_disabled;

	vote_info = container_of(work, struct pil_vote_info, load_work);
	peripheral = smd_edge_to_pil_str(SMD_APPS_MODEM);
	loading_disabled = is_pil_loading_disabled(SMD_APPS_MODEM);

	if (!IS_ERR_OR_NULL(peripheral) && !strcmp(peripheral, "modem")) {
	if (!IS_ERR_OR_NULL(peripheral) && !strcmp(peripheral, "modem") &&
	    !loading_disabled) {
		vote_info->pil_handle = subsystem_get(peripheral);
		if (IS_ERR(vote_info->pil_handle)) {
			IPC_RTR_ERR("%s: Failed to load %s\n",
@@ -714,6 +746,7 @@ static int msm_ipc_router_smd_config_init(
	smd_xprtp->xprt_version = smd_xprt_config->xprt_version;
	smd_xprtp->edge = smd_xprt_config->edge;
	smd_xprtp->xprt_option = smd_xprt_config->xprt_option;
	smd_xprtp->disable_pil_loading = smd_xprt_config->disable_pil_loading;

	strlcpy(smd_xprtp->ch_name, smd_xprt_config->ch_name,
						SMD_MAX_CH_NAME_LEN);
@@ -796,6 +829,9 @@ static int parse_devicetree(struct device_node *node,
	key = "qcom,fragmented-data";
	smd_xprt_config->xprt_option = of_property_read_bool(node, key);

	key = "qcom,disable-pil-loading";
	smd_xprt_config->disable_pil_loading = of_property_read_bool(node, key);

	scnprintf(smd_xprt_config->xprt_name, XPRT_NAME_LEN, "%s_%s",
			remote_ss, smd_xprt_config->ch_name);