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

Commit 570fa783 authored by Mao Jinlong's avatar Mao Jinlong Committed by Gerrit - the friendly Code Review server
Browse files

coresight: add the authentication logic for coresight etm



Add the authentication logic that depends on the CoreSight AUTHSTATUS
register rather than the fuses that helps in collecting the CPU trace
on the secure device if ETM is functional.

CRs-Fixed: 2236496
Change-Id: I7ca410cc7b72a98235101f64f090c65e37603d27
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
Signed-off-by: default avatarMao Jinlong <jinlmao@codeaurora.org>
parent b2f7549d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2012, 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2012, 2016, 2018, The Linux Foundation. All rights reserved.
 *
 * Description: CoreSight Program Flow Trace driver
 *
@@ -39,6 +39,7 @@

#include "coresight-etm.h"
#include "coresight-etm-perf.h"
#include "coresight-priv.h"

/*
 * Not really modular but using module_param is the easiest way to
@@ -711,6 +712,10 @@ static void etm_init_arch_data(void *info)

	CS_UNLOCK(drvdata->base);

	/* check the state of the fuse */
	if (!coresight_authstatus_enabled(drvdata->base))
		goto out;

	/* First dummy read */
	(void)etm_readl(drvdata, ETMPDSR);
	/* Provide power to ETM: ETMPDCR[3] == 1 */
@@ -742,6 +747,7 @@ static void etm_init_arch_data(void *info)

	etm_set_pwrdwn(drvdata);
	etm_clr_pwrup(drvdata);
out:
	CS_LOCK(drvdata->base);
}

+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014, 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014, 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -38,6 +38,7 @@

#include "coresight-etm4x.h"
#include "coresight-etm-perf.h"
#include "coresight-priv.h"

static int boot_enable;
module_param_named(boot_enable, boot_enable, int, 0444);
@@ -436,6 +437,9 @@ static void etm4_init_arch_data(void *info)

	CS_UNLOCK(drvdata->base);

	if (!coresight_authstatus_enabled(drvdata->base))
		goto out;

	/* find all capabilities of the tracing unit */
	etmidr0 = readl_relaxed(drvdata->base + TRCIDR0);

@@ -582,6 +586,8 @@ static void etm4_init_arch_data(void *info)
	drvdata->nrseqstate = BMVAL(etmidr5, 25, 27);
	/* NUMCNTR, bits[30:28] number of counters available for tracing */
	drvdata->nr_cntr = BMVAL(etmidr5, 28, 30);

out:
	CS_LOCK(drvdata->base);
}