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

Commit 2a7a265d authored by Ghanim Fodi's avatar Ghanim Fodi Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa3: Ring IPA MHI event ring doorbell on channel start



Ringing IPA MHI event ring doorbell is done at MHI device
during MHI channel start. This is done after the rings
are allocated. The ring write pointer updated by the host is
used as the doorbell value. Doorbell ringing is required
in order to supply event credits to GSI H/W.

Change-Id: I2db110b4f99c8ab6c6878d426b3ebb37149b0b76
Signed-off-by: default avatarGhanim Fodi <gfodi@codeaurora.org>
parent 827c6ada
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1339,6 +1339,35 @@ int gsi_query_evt_ring_db_addr(unsigned long evt_ring_hdl,
}
EXPORT_SYMBOL(gsi_query_evt_ring_db_addr);

int gsi_ring_evt_ring_db(unsigned long evt_ring_hdl, uint64_t value)
{
	struct gsi_evt_ctx *ctx;

	if (!gsi_ctx) {
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return -GSI_STATUS_NODEV;
	}

	if (evt_ring_hdl >= gsi_ctx->max_ev) {
		GSIERR("bad params evt_ring_hdl=%lu\n", evt_ring_hdl);
		return -GSI_STATUS_INVALID_PARAMS;
	}

	ctx = &gsi_ctx->evtr[evt_ring_hdl];

	if (ctx->state != GSI_EVT_RING_STATE_ALLOCATED) {
		GSIERR("bad state %d\n",
				gsi_ctx->evtr[evt_ring_hdl].state);
		return -GSI_STATUS_UNSUPPORTED_OP;
	}

	ctx->ring.wp_local = value;
	gsi_ring_evt_doorbell(ctx);

	return GSI_STATUS_SUCCESS;
}
EXPORT_SYMBOL(gsi_ring_evt_ring_db);

int gsi_reset_evt_ring(unsigned long evt_ring_hdl)
{
	uint32_t val;
+18 −0
Original line number Diff line number Diff line
@@ -255,6 +255,24 @@ static int ipa_mhi_start_gsi_channel(enum ipa_client_type client,
		ep->gsi_evt_ring_hdl = *params->cached_gsi_evt_ring_hdl;
	}

	if (params->ev_ctx_host->wp == params->ev_ctx_host->rbase) {
		IPA_MHI_ERR("event ring wp is not updated. base=wp=0x%llx\n",
			params->ev_ctx_host->wp);
		goto fail_alloc_ch;
		return res;
	}

	IPA_MHI_DBG("Ring event db: evt_ring_hdl=%lu host_wp=0x%llx\n",
		ep->gsi_evt_ring_hdl, params->ev_ctx_host->wp);
	res = gsi_ring_evt_ring_db(ep->gsi_evt_ring_hdl,
		params->ev_ctx_host->wp);
	if (res) {
		IPA_MHI_ERR("fail to ring evt ring db %d. hdl=%lu wp=0x%llx\n",
			res, ep->gsi_evt_ring_hdl, params->ev_ctx_host->wp);
		goto fail_alloc_ch;
		return res;
	}

	memset(&ch_props, 0, sizeof(ch_props));
	ch_props.prot = GSI_CHAN_PROT_MHI;
	ch_props.dir = IPA_CLIENT_IS_PROD(client) ?
+18 −0
Original line number Diff line number Diff line
@@ -750,6 +750,18 @@ int gsi_dealloc_evt_ring(unsigned long evt_ring_hdl);
int gsi_query_evt_ring_db_addr(unsigned long evt_ring_hdl,
		uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb);

/**
 * gsi_ring_evt_ring_db - Peripheral should call this function for
 * ringing the event ring doorbell with given value
 *
 * @evt_ring_hdl:    Client handle previously obtained from
 *	     gsi_alloc_evt_ring
 * @value:           The value to be used for ringing the doorbell
 *
 * @Return gsi_status
 */
int gsi_ring_evt_ring_db(unsigned long evt_ring_hdl, uint64_t value);

/**
 * gsi_reset_evt_ring - Peripheral should call this function to
 * reset an event ring to recover from error state
@@ -1141,6 +1153,12 @@ static inline int gsi_query_evt_ring_db_addr(unsigned long evt_ring_hdl,
	return -GSI_STATUS_UNSUPPORTED_OP;
}

static inline int gsi_ring_evt_ring_db(unsigned long evt_ring_hdl,
		uint64_t value)
{
	return -GSI_STATUS_UNSUPPORTED_OP;
}

static inline int gsi_reset_evt_ring(unsigned long evt_ring_hdl)
{
	return -GSI_STATUS_UNSUPPORTED_OP;