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

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

Merge "msm: IPA: uC debug stats for loadable modules"

parents 7bfb7b47 fd4caf0f
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -3706,6 +3706,45 @@ void ipa_deregister_client_callback(enum ipa_client_type client)
}
EXPORT_SYMBOL(ipa_deregister_client_callback);

int ipa_uc_debug_stats_alloc(
	struct IpaHwOffloadStatsAllocCmdData_t cmdinfo)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_uc_debug_stats_alloc, cmdinfo);

	return ret;
}
EXPORT_SYMBOL(ipa_uc_debug_stats_alloc);

int ipa_uc_debug_stats_dealloc(uint32_t prot_id)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_uc_debug_stats_dealloc, prot_id);

	return ret;
}
EXPORT_SYMBOL(ipa_uc_debug_stats_dealloc);

void ipa_get_gsi_stats(int prot_id,
	struct ipa_uc_dbg_ring_stats *stats)
{
	IPA_API_DISPATCH(ipa_get_gsi_stats,
		prot_id, stats);
}
EXPORT_SYMBOL(ipa_get_gsi_stats);

int ipa_get_prot_id(enum ipa_client_type client)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_get_prot_id,
		client);

	return ret;
}
EXPORT_SYMBOL(ipa_get_prot_id);

static const struct dev_pm_ops ipa_pm_ops = {
	.suspend_noirq = ipa_ap_suspend,
+10 −0
Original line number Diff line number Diff line
@@ -470,8 +470,18 @@ struct ipa_api_controller {
		bool (*teth_port_state)(void), enum ipa_client_type client);

	void (*ipa_deregister_client_callback)(enum ipa_client_type client);

	bool (*ipa_get_lan_rx_napi)(void);

	int (*ipa_uc_debug_stats_alloc)(
		struct IpaHwOffloadStatsAllocCmdData_t cmdinfo);

	int (*ipa_uc_debug_stats_dealloc)(uint32_t prot_id);

	void (*ipa_get_gsi_stats)(int prot_id,
		struct ipa_uc_dbg_ring_stats *stats);

	int (*ipa_get_prot_id)(enum ipa_client_type client);
};

#if IS_ENABLED(CONFIG_IPA3)
+1 −1
Original line number Diff line number Diff line
@@ -6555,7 +6555,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
	for (i = 0; i < IPA_HW_PROTOCOL_MAX; i++) {
		ipa3_ctx->gsi_info[i].protocol = i;
		/* initialize all to be not started */
		for (j = 0; j < MAX_CH_STATS_SUPPORTED; j++)
		for (j = 0; j < IPA_MAX_CH_STATS_SUPPORTED; j++)
			ipa3_ctx->gsi_info[i].ch_id_info[j].ch_id =
				0xFF;
	}
+47 −1
Original line number Diff line number Diff line
@@ -739,7 +739,7 @@ EXPORT_SYMBOL(ipa3_set_usb_max_packet_size);
 * @note Cannot be called from atomic context
 *
 */
int ipa3_get_usb_gsi_stats(struct ipa3_uc_dbg_ring_stats *stats)
int ipa3_get_usb_gsi_stats(struct ipa_uc_dbg_ring_stats *stats)
{
	int i;

@@ -1801,5 +1801,51 @@ int ipa3_clear_endpoint_delay(u32 clnt_hdl)

	IPADBG("client (ep: %d) removed ep delay\n", clnt_hdl);

	return 0;
}

/**
 * ipa3_get_aqc_gsi_stats() - Query AQC gsi stats from uc
 * @stats:	[inout] stats blob from client populated by driver
 *
 * Returns:	0 on success, negative on failure
 *
 * @note Cannot be called from atomic context
 *
 */
int ipa3_get_aqc_gsi_stats(struct ipa_uc_dbg_ring_stats *stats)
{
	int i;

	if (!ipa3_ctx->aqc_ctx.dbg_stats.uc_dbg_stats_mmio) {
		IPAERR("bad parms NULL aqc_gsi_stats_mmio\n");
		return -EINVAL;
	}
	IPA_ACTIVE_CLIENTS_INC_SIMPLE();
	for (i = 0; i < MAX_AQC_CHANNELS; i++) {
		stats->ring[i].ringFull = ioread32(
			ipa3_ctx->aqc_ctx.dbg_stats.uc_dbg_stats_mmio
			+ i * IPA3_UC_DEBUG_STATS_OFF +
			IPA3_UC_DEBUG_STATS_RINGFULL_OFF);
		stats->ring[i].ringEmpty = ioread32(
			ipa3_ctx->aqc_ctx.dbg_stats.uc_dbg_stats_mmio
			+ i * IPA3_UC_DEBUG_STATS_OFF +
			IPA3_UC_DEBUG_STATS_RINGEMPTY_OFF);
		stats->ring[i].ringUsageHigh = ioread32(
			ipa3_ctx->aqc_ctx.dbg_stats.uc_dbg_stats_mmio
			+ i * IPA3_UC_DEBUG_STATS_OFF +
			IPA3_UC_DEBUG_STATS_RINGUSAGEHIGH_OFF);
		stats->ring[i].ringUsageLow = ioread32(
			ipa3_ctx->aqc_ctx.dbg_stats.uc_dbg_stats_mmio
			+ i * IPA3_UC_DEBUG_STATS_OFF +
			IPA3_UC_DEBUG_STATS_RINGUSAGELOW_OFF);
		stats->ring[i].RingUtilCount = ioread32(
			ipa3_ctx->aqc_ctx.dbg_stats.uc_dbg_stats_mmio
			+ i * IPA3_UC_DEBUG_STATS_OFF +
			IPA3_UC_DEBUG_STATS_RINGUTILCOUNT_OFF);
	}
	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();


	return 0;
}
+35 −5
Original line number Diff line number Diff line
@@ -2416,7 +2416,7 @@ static ssize_t ipa3_read_ipahal_regs(struct file *file, char __user *ubuf,
static ssize_t ipa3_read_wdi_gsi_stats(struct file *file,
		char __user *ubuf, size_t count, loff_t *ppos)
{
	struct ipa3_uc_dbg_ring_stats stats;
	struct ipa_uc_dbg_ring_stats stats;
	int nbytes;
	int cnt = 0;

@@ -2464,7 +2464,7 @@ static ssize_t ipa3_read_wdi_gsi_stats(struct file *file,
static ssize_t ipa3_read_wdi3_gsi_stats(struct file *file,
		char __user *ubuf, size_t count, loff_t *ppos)
{
	struct ipa3_uc_dbg_ring_stats stats;
	struct ipa_uc_dbg_ring_stats stats;
	int nbytes;
	int cnt = 0;

@@ -2529,6 +2529,7 @@ static ssize_t ipa3_read_11ad_gsi_stats(struct file *file,
static ssize_t ipa3_read_aqc_gsi_stats(struct file *file,
		char __user *ubuf, size_t count, loff_t *ppos)
{
	struct ipa_uc_dbg_ring_stats stats;
	int nbytes;
	int cnt = 0;

@@ -2538,7 +2539,36 @@ static ssize_t ipa3_read_aqc_gsi_stats(struct file *file,
		cnt += nbytes;
		goto done;
	}
	return 0;
	if (!ipa3_get_aqc_gsi_stats(&stats)) {
		nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
			"TX ringFull=%u\n"
			"TX ringEmpty=%u\n"
			"TX ringUsageHigh=%u\n"
			"TX ringUsageLow=%u\n"
			"TX RingUtilCount=%u\n",
			stats.ring[1].ringFull,
			stats.ring[1].ringEmpty,
			stats.ring[1].ringUsageHigh,
			stats.ring[1].ringUsageLow,
			stats.ring[1].RingUtilCount);
		cnt += nbytes;
		nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
			"RX ringFull=%u\n"
			"RX ringEmpty=%u\n"
			"RX ringUsageHigh=%u\n"
			"RX ringUsageLow=%u\n"
			"RX RingUtilCount=%u\n",
			stats.ring[0].ringFull,
			stats.ring[0].ringEmpty,
			stats.ring[0].ringUsageHigh,
			stats.ring[0].ringUsageLow,
			stats.ring[0].RingUtilCount);
		cnt += nbytes;
	} else {
		nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
			"Fail to read AQC GSI stats\n");
		cnt += nbytes;
	}
done:
	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt);
}
@@ -2546,7 +2576,7 @@ static ssize_t ipa3_read_aqc_gsi_stats(struct file *file,
static ssize_t ipa3_read_mhip_gsi_stats(struct file *file,
	char __user *ubuf, size_t count, loff_t *ppos)
{
	struct ipa3_uc_dbg_ring_stats stats;
	struct ipa_uc_dbg_ring_stats stats;
	int nbytes;
	int cnt = 0;

@@ -2618,7 +2648,7 @@ static ssize_t ipa3_read_mhip_gsi_stats(struct file *file,
static ssize_t ipa3_read_usb_gsi_stats(struct file *file,
	char __user *ubuf, size_t count, loff_t *ppos)
{
	struct ipa3_uc_dbg_ring_stats stats;
	struct ipa_uc_dbg_ring_stats stats;
	int nbytes;
	int cnt = 0;

Loading