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

Commit 5d2a069b authored by Da Hoon Pyun's avatar Da Hoon Pyun
Browse files

msm: npu: Send IPCC irq directly while apps crashes



Before subsystem resets NPU to collect the dump, it will send
force-stop notification to NPU via smp2p. But triggering the
ipcc irq is done by the worker thread in npu driver which is
not possible to run in this scenario. This change is to trigger
this irq when system crash notification is received as a
solution.

Change-Id: Ifa3a420500f06d109d6c0ad4d652199fdf4a97b1
Signed-off-by: default avatarDa Hoon Pyun <dpyun@codeaurora.org>
parent fdc5714c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -342,4 +342,6 @@ int unload_fw(struct npu_device *npu_dev);
int npu_set_bw(struct npu_device *npu_dev, int new_ib, int new_ab);
int npu_process_kevent(struct npu_client *client, struct npu_kevent *kevt);
int npu_notify_cdsprm_cxlimit_activity(struct npu_device *npu_dev, bool enable);
int npu_bridge_mbox_send_data(struct npu_host_ctx *host_ctx,
	struct npu_mbox *mbox, void *data);
#endif /* _NPU_COMMON_H */
+4 −0
Original line number Diff line number Diff line
@@ -2199,6 +2199,10 @@ static int npu_ipcc_bridge_mbox_send_data(struct mbox_chan *chan, void *data)
	queue_work(host_ctx->wq, &host_ctx->bridge_mbox_work);
	spin_unlock_irqrestore(&host_ctx->bridge_mbox_lock, flags);

	if (host_ctx->app_crashed)
		npu_bridge_mbox_send_data(host_ctx,
					ipcc_mbox_chan->npu_mbox, NULL);

	return 0;
}

+28 −1
Original line number Diff line number Diff line
@@ -672,6 +672,25 @@ static int npu_notifier_cb(struct notifier_block *this, unsigned long code,
	return ret;
}

static int npu_panic_handler(struct notifier_block *this,
				unsigned long event, void *ptr)
{
	int i;
	struct npu_host_ctx *host_ctx =
		container_of(this, struct npu_host_ctx, panic_nb);
	struct npu_device *npu_dev = host_ctx->npu_dev;

	NPU_INFO("Apps crashed\n");

	for (i = 0; i < NPU_MAX_MBOX_NUM; i++)
		if (npu_dev->mbox[i].send_data_pending)
			npu_bridge_mbox_send_data(host_ctx,
				&npu_dev->mbox[i], NULL);

	host_ctx->app_crashed = true;
	return NOTIFY_DONE;
}

static void npu_update_pwr_work(struct work_struct *work)
{
	int ret;
@@ -724,6 +743,14 @@ int npu_host_init(struct npu_device *npu_dev)
		goto fail;
	}

	host_ctx->panic_nb.notifier_call = npu_panic_handler;
	ret = atomic_notifier_chain_register(&panic_notifier_list,
		&host_ctx->panic_nb);
	if (ret) {
		NPU_ERR("register panic notifier failed\n");
		goto fail;
	}

	host_ctx->wq = create_workqueue("npu_general_wq");
	host_ctx->wq_pri =
		alloc_workqueue("npu_ipc_wq", WQ_HIGHPRI | WQ_UNBOUND, 0);
@@ -1104,7 +1131,7 @@ static void npu_disable_fw_work(struct work_struct *work)
	NPU_DBG("Exit disable fw work\n");
}

static int npu_bridge_mbox_send_data(struct npu_host_ctx *host_ctx,
int npu_bridge_mbox_send_data(struct npu_host_ctx *host_ctx,
	struct npu_mbox *mbox, void *data)
{
	NPU_DBG("Generating IRQ for client_id: %u; signal_id: %u\n",
+2 −0
Original line number Diff line number Diff line
@@ -132,7 +132,9 @@ struct npu_host_ctx {
	uint32_t wdg_irq_sts;
	bool fw_error;
	bool cancel_work;
	bool app_crashed;
	struct notifier_block nb;
	struct notifier_block panic_nb;
	void *notif_hdle;
	spinlock_t bridge_mbox_lock;
	bool bridge_mbox_pwr_on;