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

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

Merge "coresight: get etm funnel port for associated cpu"

parents 64c9c7d1 3e576089
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1920,6 +1920,20 @@ static const struct attribute_group *etm_attr_grps[] = {
	NULL,
};

int coresight_etm_get_funnel_port(int cpu)
{
	struct coresight_platform_data *pdata;

	if (cpu > num_possible_cpus())
		return -EINVAL;
	if (!etmdrvdata[cpu])
		return -ENODEV;

	pdata = etmdrvdata[cpu]->dev->platform_data;
	return pdata->child_ports[0];
}
EXPORT_SYMBOL(coresight_etm_get_funnel_port);

static bool etm_arch_supported(uint8_t arch)
{
	switch (arch) {
+14 −0
Original line number Diff line number Diff line
@@ -2913,6 +2913,20 @@ static const struct attribute_group *etm_attr_grps[] = {
	NULL,
};

int coresight_etm_get_funnel_port(int cpu)
{
	struct coresight_platform_data *pdata;

	if (cpu > num_possible_cpus())
		return -EINVAL;
	if (!etmdrvdata[cpu])
		return -ENODEV;

	pdata = etmdrvdata[cpu]->dev->platform_data;
	return pdata->child_ports[0];
}
EXPORT_SYMBOL(coresight_etm_get_funnel_port);

static void etm_init_arch_data(void *info)
{
	uint32_t etmidr0;
+18 −4
Original line number Diff line number Diff line
@@ -111,12 +111,19 @@ static int funnel_enable_cpu_port(struct notifier_block *this,
	struct funnel_drvdata *drvdata = container_of(this,
						      struct funnel_drvdata,
						      jtag_restore_blk);
	int port;
	int cpu = raw_smp_processor_id();

	port = coresight_etm_get_funnel_port(cpu);
	if (port < 0) {
		pr_warn_ratelimited("error retrieving ETM funnel port: %#x\n",
				     port);
		return notifier_from_errno(port);
	}
	spin_lock(&drvdata->spinlock);
	if (!test_bit(cpu, drvdata->inport))
	if (!test_bit(port, drvdata->inport))
		goto out;
	__funnel_enable(drvdata, cpu);
	__funnel_enable(drvdata, port);
out:
	spin_unlock(&drvdata->spinlock);
	return NOTIFY_OK;
@@ -156,12 +163,19 @@ static int funnel_disable_cpu_port(struct notifier_block *this,
	struct funnel_drvdata *drvdata = container_of(this,
						      struct funnel_drvdata,
						      jtag_save_blk);
	int port;
	int cpu = raw_smp_processor_id();

	port = coresight_etm_get_funnel_port(cpu);
	if (port < 0) {
		pr_warn_ratelimited("error retrieving ETM funnel port: %#x\n",
				     port);
		return notifier_from_errno(port);
	}
	spin_lock(&drvdata->spinlock);
	if (!test_bit(cpu, drvdata->inport))
	if (!test_bit(port, drvdata->inport))
		goto out;
	__funnel_disable(drvdata, cpu);
	__funnel_disable(drvdata, port);
out:
	spin_unlock(&drvdata->spinlock);
	return NOTIFY_OK;
+5 −0
Original line number Diff line number Diff line
@@ -68,5 +68,10 @@ extern void etm_writel_cp14(uint32_t val, uint32_t off);
static inline unsigned int etm_readl_cp14(uint32_t off) { return 0; }
static inline void etm_writel_cp14(uint32_t val, uint32_t off) {}
#endif
#if defined(CONFIG_CORESIGHT_ETM) || defined(CONFIG_CORESIGHT_ETMV4)
extern int coresight_etm_get_funnel_port(int cpu);
#else
static inline int coresight_etm_get_funnel_port(int cpu) { return -ENOSYS; }
#endif

#endif