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

Commit d1338e7f authored by Rama Aparna Mallavarapu's avatar Rama Aparna Mallavarapu Committed by Mulu He
Browse files

coresight: etm4x: Fix ETM probe when booting without all cores



We need to fail probe when ETM init fails due to CPU being unavailable
at probe time. There is no current support to defer probe when we hot
plug in the CPU. Also, check for the architecture version of ETM HW
only when ETM init is successful.

Change-Id: I0fc7b3ca5c919a74dfecedcd6278a0e0679f276f
Signed-off-by: default avatarSatyajit Desai <sadesai@codeaurora.org>
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
Signed-off-by: default avatarMulu He <muluhe@codeaurora.org>
parent c992c847
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2014,2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014,2016,2018, The Linux Foundation. All rights reserved.
 */

#include <linux/kernel.h>
@@ -980,12 +980,16 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
	drvdata->cpu = pdata ? pdata->cpu : 0;

	cpus_read_lock();
	etmdrvdata[drvdata->cpu] = drvdata;

	if (smp_call_function_single(drvdata->cpu,
				etm4_init_arch_data,  drvdata, 1))
	ret = smp_call_function_single(drvdata->cpu,
					etm4_init_arch_data, drvdata, 1);
	if (ret) {
		dev_err(dev, "ETM arch init failed\n");

		cpus_read_unlock();
		return ret;
	} else if (!etm4_arch_supported(drvdata->arch)) {
		cpus_read_unlock();
		return -EINVAL;
	}
	if (!etm4_count++) {
		cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING,
						     "arm/coresight4:starting",
@@ -1000,11 +1004,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)

	cpus_read_unlock();

	if (etm4_arch_supported(drvdata->arch) == false) {
		ret = -EINVAL;
		goto err_arch_supported;
	}

	etm4_init_trace_id(drvdata);
	etm4_set_default(&drvdata->config);

@@ -1027,6 +1026,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
	}

	pm_runtime_put(&adev->dev);
	etmdrvdata[drvdata->cpu] = drvdata;
	dev_info(dev, "CPU%d: ETM v%d.%d initialized\n",
		 drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf);