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

Commit 3143d4b7 authored by Bojun Pan's avatar Bojun Pan Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa4: capture the unclock gsi IPA register access



Add more protect on the unclock gsi IPA register access.
In case this is a valid access, assert before disabling
the IPA clock.

Change-Id: If2cc5a9942a5e457bbd8badaabde78138f676176
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent 76a8b953
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -755,6 +755,8 @@ static void gsi_handle_irq(void)
	unsigned long cnt = 0;

	while (1) {
		if (!gsi_ctx->per.clk_status_cb())
			break;
		type = gsi_readl(gsi_ctx->base +
			GSI_EE_n_CNTXT_TYPE_IRQ_OFFS(ee));

@@ -2782,6 +2784,15 @@ int gsi_query_channel_db_addr(unsigned long chan_hdl,
}
EXPORT_SYMBOL(gsi_query_channel_db_addr);

int gsi_pending_irq_type(void)
{
	int ee = gsi_ctx->per.ee;

	return gsi_readl(gsi_ctx->base +
		GSI_EE_n_CNTXT_TYPE_IRQ_OFFS(ee));
}
EXPORT_SYMBOL(gsi_pending_irq_type);

int gsi_start_channel(unsigned long chan_hdl)
{
	enum gsi_ch_cmd_opcode op = GSI_CH_START;
+13 −0
Original line number Diff line number Diff line
@@ -4831,6 +4831,8 @@ void _ipa_disable_clks_v3_0(void)
 */
void ipa3_disable_clks(void)
{
	int type;

	if (ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_NORMAL) {
		IPAERR("not supported in this mode\n");
		return;
@@ -4844,6 +4846,17 @@ void ipa3_disable_clks(void)
	 */
	atomic_set(&ipa3_ctx->ipa_clk_vote, 0);

	/*
	 * If there is still pending gsi irq, this indicate
	 * issue on GSI FW side. We need to capture before
	 * turn off the ipa clock.
	 */
	type = gsi_pending_irq_type();
	if (type) {
		IPAERR("unexpected gsi irq type: %d\n", type);
		ipa_assert();
	}

	ipa3_ctx->ctrl->ipa3_disable_clks();

	ipa_pm_set_clock_index(0);
+14 −0
Original line number Diff line number Diff line
@@ -1316,6 +1316,16 @@ int gsi_write_channel_scratch2_reg(unsigned long chan_hdl,
int gsi_read_channel_scratch(unsigned long chan_hdl,
		union __packed gsi_channel_scratch *val);

/**
 * gsi_pending_irq_type - Peripheral should call this function to
 * check if there is any pending irq
 *
 * This function can sleep
 *
 * @Return gsi_irq_type
 */
int gsi_pending_irq_type(void);

/**
 * gsi_update_mhi_channel_scratch - MHI Peripheral should call this
 * function to update the scratch area of the channel context. Updating
@@ -1790,6 +1800,10 @@ static inline int gsi_read_channel_scratch(unsigned long chan_hdl,
	return -GSI_STATUS_UNSUPPORTED_OP;
}

static inline int gsi_pending_irq_type(void)
{
}

static inline int gsi_update_mhi_channel_scratch(unsigned long chan_hdl,
		struct __packed gsi_mhi_channel_scratch mscr)
{