Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp247187rdd; Tue, 9 Jan 2024 02:59:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG60edTzf9krcyDq7jKctqTjGtwuP05xeTeMAKtKWQgQhmhlOPc6yhTVwp+4tE08StDc8Mq X-Received: by 2002:a05:6870:7254:b0:1fb:75a:c448 with SMTP id y20-20020a056870725400b001fb075ac448mr4215358oaf.113.1704797954190; Tue, 09 Jan 2024 02:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704797954; cv=none; d=google.com; s=arc-20160816; b=EEH5BfUWiqBrGZN1jG+Vy1LuZ/9yFtFAT/ONDzpThqK1CRE1K6RNQutpBw5Kshv2Yq CfbjdDNdHbkuSLKOnC3pGbRgrvKnDPgV0S9m4nJueEHHaq5VIU5C71bCPiHaiqfwEaRD MGxC1xLIGvnvxMI1t2UKdUxVm3Mi1W+QOHNfWrht63+hHDZFkFdbDWoQZE3oNFn8eOEN IR5AeGcmulS21W8aXCn0j5fDGUk7BB6r9Jw8MQH7SvU+xUY/M/tImIHq44rHPBTL82a1 TIhwSN3xXIVINP4GOzHbY5wCTselMvjLWpIc5IIw9aSKdp8UgZ5CzuJkayvef01sdwyX IEmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=qExdbEZLrlbm0GtqhjF2qlA6x7loHmFkphmKJfqOl9Q=; fh=8WQGIKVdYFTqw9k0MmI+bZhfNaUOFWrYVWYr3t7bIYo=; b=gWV0o6OiszJs1JekOuMw5pu/oeYzb7YX8f5HTnuhlXlACKOKVs6z2H+Ics2nNW9yqW vi4Dw19ecen7YjwS/Eu1f7jYByBpXw7/h6g+/hggtOHAIvryX4yqaIlzhcPdQgtZykdK +S+HuHwU16PAGryBraOv/Vv9EHKRGNfRFg1g3ivvHDt6HWzzMz7iwDguiSGp7Fo1nrKN fDDVykFDmgf95j3PAqhFql2TYk2uePOktkzjhyW1WB8g0TbvRBfJjIyi16eDBlr7uatF BY+Vd12RYGdck4sjrPbgqLbdnmpWAUNYhfvJYjhZgqYZNds84H+gAwrqBTjaeuqIMg2T LWiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20736-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20736-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s14-20020ac85cce000000b0042980d58157si1795519qta.472.2024.01.09.02.59.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 02:59:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20736-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20736-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20736-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DA6331C23EDC for ; Tue, 9 Jan 2024 10:59:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CFB236AE9; Tue, 9 Jan 2024 10:59:06 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D6C336AE0; Tue, 9 Jan 2024 10:59:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E70B5C15; Tue, 9 Jan 2024 02:59:48 -0800 (PST) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9B2173F73F; Tue, 9 Jan 2024 02:59:01 -0800 (PST) Message-ID: <8d37d907-68c3-4e77-995b-bc85a0c3b8f0@arm.com> Date: Tue, 9 Jan 2024 10:59:00 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 6/7] coresight: tmc: Stop trace capture on FlIn Content-Language: en-US To: Mike Leach , Linu Cherian Cc: james.clark@arm.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org, sgoutham@marvell.com, gcherian@marvell.com References: <20240105055840.1977897-1-lcherian@marvell.com> <20240105055840.1977897-7-lcherian@marvell.com> From: Suzuki K Poulose In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 05/01/2024 16:11, Mike Leach wrote: > Hi, > > On Fri, 5 Jan 2024 at 05:59, Linu Cherian wrote: >> >> Configure TMC ETR and ETF to flush and stop trace capture >> on FlIn event. As a side effect, do manual flush only if >> auto flush fails. >> >> Signed-off-by: Linu Cherian >> --- >> Changelog from v5: >> * No changes >> >> drivers/hwtracing/coresight/coresight-tmc-etf.c | 10 ++++++++-- >> drivers/hwtracing/coresight/coresight-tmc-etr.c | 10 ++++++++-- >> drivers/hwtracing/coresight/coresight-tmc.h | 3 +++ >> 3 files changed, 19 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c >> index 72c2315f4e23..57a9a9300d36 100644 >> --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c >> +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c >> @@ -34,7 +34,7 @@ static int __tmc_etb_enable_hw(struct tmc_drvdata *drvdata) >> writel_relaxed(TMC_MODE_CIRCULAR_BUFFER, drvdata->base + TMC_MODE); >> writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI | >> TMC_FFCR_FON_FLIN | TMC_FFCR_FON_TRIG_EVT | >> - TMC_FFCR_TRIGON_TRIGIN, >> + TMC_FFCR_TRIGON_TRIGIN | TMC_FFCR_STOP_ON_FLUSH, >> drvdata->base + TMC_FFCR); >> > > This is a problem. Setting TMC_FFCR_STOP_ON_FLUSH changes the > fundamentals of trigger event handling. Without this bit ETM can > generate multiple event + triggers which are then embedded into the > formatted trace stream for later search. > With this new bit the capture will stop on the first event. Setting > this bit should be dependent on the mode being set to ETR_MODE_RESRV > > > >> writel_relaxed(drvdata->trigger_cntr, drvdata->base + TMC_TRG); >> @@ -615,7 +615,13 @@ static int tmc_panic_sync_etf(struct coresight_device *csdev) >> if (val != TMC_MODE_CIRCULAR_BUFFER) >> goto out; >> >> - tmc_flush_and_stop(drvdata); >> + val = readl(drvdata->base + TMC_FFSR); >> + /* Do manual flush and stop only if its not auto-stopped */ >> + if (!(val & TMC_FFSR_FT_STOPPED)) { >> + dev_info(&csdev->dev, >> + "%s: Triggering manual flush\n", __func__); >> + tmc_flush_and_stop(drvdata); >> + } >> > Is there some reason to believe that the stop on flush will not work? > > Using this conditional skips the tmc_wait_for_tmcready() called by > tmc_flush_and_stop() if the formatter is stopped - which is a > different condition test on a different register. Or even a new sysfs handle to turn this on ? e.g., /sys/bus/coresight/devices/tmc_etfN/stop_on_flush That can be honoured only in the sysfs mode and set accordingly by the user ? e.g., for f in $(find /sys/bus/coresight/devices/ -maxdepth 1 -name tmc_\*) do echo 1 > $f/stop_on_flush done Suzuki > > Why is this block of code not in the patch that introduces the > tmc_panic_sync_etf() > >> /* Sync registers from hardware to metadata region */ >> mdata->sts = csdev_access_relaxed_read32(csa, TMC_STS); >> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c >> index ab7521bbb2f5..4b3c7ec7f62b 100644 >> --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c >> +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c >> @@ -1113,7 +1113,7 @@ static int __tmc_etr_enable_hw(struct tmc_drvdata *drvdata) >> >> writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI | >> TMC_FFCR_FON_FLIN | TMC_FFCR_FON_TRIG_EVT | >> - TMC_FFCR_TRIGON_TRIGIN, >> + TMC_FFCR_TRIGON_TRIGIN | TMC_FFCR_STOP_ON_FLUSH, >> drvdata->base + TMC_FFCR); >> writel_relaxed(drvdata->trigger_cntr, drvdata->base + TMC_TRG); >> tmc_enable_hw(drvdata); >> @@ -1846,7 +1846,13 @@ static int tmc_panic_sync_etr(struct coresight_device *csdev) >> if (!(val & TMC_CTL_CAPT_EN)) >> goto out; >> >> - tmc_flush_and_stop(drvdata); >> + val = readl(drvdata->base + TMC_FFSR); >> + /* Do manual flush and stop only if its not auto-stopped */ >> + if (!(val & TMC_FFSR_FT_STOPPED)) { >> + dev_info(&csdev->dev, >> + "%s: Triggering manual flush\n", __func__); >> + tmc_flush_and_stop(drvdata); >> + } >> > > Above comments for etf apply equally to etr. > > Regards > > Mike > >> /* Sync registers from hardware to metadata region */ >> mdata->size = csdev_access_relaxed_read32(csa, TMC_RSZ); >> diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h >> index 6e1e910d5ea4..cf9313b302c7 100644 >> --- a/drivers/hwtracing/coresight/coresight-tmc.h >> +++ b/drivers/hwtracing/coresight/coresight-tmc.h >> @@ -77,6 +77,9 @@ >> #define TMC_AXICTL_AXCACHE_OS (0xf << 2) >> #define TMC_AXICTL_ARCACHE_OS (0xf << 16) >> >> +/* TMC_FFSR - 0x300 */ >> +#define TMC_FFSR_FT_STOPPED BIT(1) >> + >> /* TMC_FFCR - 0x304 */ >> #define TMC_FFCR_FLUSHMAN_BIT 6 >> #define TMC_FFCR_EN_FMT BIT(0) >> -- >> 2.34.1 >> > > > -- > Mike Leach > Principal Engineer, ARM Ltd. > Manchester Design Centre. UK