* [PATCH] coresight: Fix disabling of CoreSight TPIU
@ 2017-11-24 9:58 Robert Walker
2017-11-27 17:30 ` Mathieu Poirier
2017-12-07 16:14 ` Mike Leach
0 siblings, 2 replies; 6+ messages in thread
From: Robert Walker @ 2017-11-24 9:58 UTC (permalink / raw)
To: linux-arm-kernel
The CoreSight TPIU should be disabled when tracing to other sinks to allow
them to operate at full bandwidth.
This patch fixes tpiu_disable_hw() to correctly disable the TPIU by
configuring the TPIU to stop on flush, initiating a manual flush, waiting
for the flush to complete and then waits for the TPIU to indicate it has
stopped.
Signed-off-by: Robert Walker <robert.walker@arm.com>
---
drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
index bef49a3..4b46c49 100644
--- a/drivers/hwtracing/coresight/coresight-tpiu.c
+++ b/drivers/hwtracing/coresight/coresight-tpiu.c
@@ -46,8 +46,11 @@
#define TPIU_ITATBCTR0 0xef8
/** register definition **/
+/* FFSR - 0x300 */
+#define FFSR_FT_STOPPED BIT(1)
/* FFCR - 0x304 */
#define FFCR_FON_MAN BIT(6)
+#define FFCR_STOP_FI BIT(12)
/**
* @base: memory mapped base address for this component.
@@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
{
CS_UNLOCK(drvdata->base);
- /* Clear formatter controle reg. */
- writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
+ /* Clear formatter and stop on flush */
+ writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
/* Generate manual flush */
- writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
+ writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
+ /* Wait for flush to complete */
+ coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
+ /* Wait for formatter to stop */
+ coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
CS_LOCK(drvdata->base);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] coresight: Fix disabling of CoreSight TPIU
2017-11-24 9:58 [PATCH] coresight: Fix disabling of CoreSight TPIU Robert Walker
@ 2017-11-27 17:30 ` Mathieu Poirier
2017-11-28 8:55 ` Robert Walker
2017-12-07 16:14 ` Mike Leach
1 sibling, 1 reply; 6+ messages in thread
From: Mathieu Poirier @ 2017-11-27 17:30 UTC (permalink / raw)
To: linux-arm-kernel
Hi Robert,
On 24 November 2017 at 02:58, Robert Walker <robert.walker@arm.com> wrote:
> The CoreSight TPIU should be disabled when tracing to other sinks to allow
> them to operate at full bandwidth.
>
> This patch fixes tpiu_disable_hw() to correctly disable the TPIU by
> configuring the TPIU to stop on flush, initiating a manual flush, waiting
> for the flush to complete and then waits for the TPIU to indicate it has
> stopped.
>
> Signed-off-by: Robert Walker <robert.walker@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
> index bef49a3..4b46c49 100644
> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
> @@ -46,8 +46,11 @@
> #define TPIU_ITATBCTR0 0xef8
>
> /** register definition **/
> +/* FFSR - 0x300 */
> +#define FFSR_FT_STOPPED BIT(1)
> /* FFCR - 0x304 */
> #define FFCR_FON_MAN BIT(6)
> +#define FFCR_STOP_FI BIT(12)
>
> /**
> * @base: memory mapped base address for this component.
> @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
> {
> CS_UNLOCK(drvdata->base);
>
> - /* Clear formatter controle reg. */
> - writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
> + /* Clear formatter and stop on flush */
> + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
> /* Generate manual flush */
> - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
> + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
> + /* Wait for flush to complete */
> + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
> + /* Wait for formatter to stop */
> + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
>
> CS_LOCK(drvdata->base);
> }
Shouldn't we also do this at boot time when the TPIU in _probed() ?
That way the TPIU doesn't have to explicitly be enabled and disabled
prior to running other tracing sessions.
Thanks,
Mathieu
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] coresight: Fix disabling of CoreSight TPIU
2017-11-27 17:30 ` Mathieu Poirier
@ 2017-11-28 8:55 ` Robert Walker
2017-11-28 15:24 ` Mathieu Poirier
0 siblings, 1 reply; 6+ messages in thread
From: Robert Walker @ 2017-11-28 8:55 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mathieu,
> -----Original Message-----
> From: Mathieu Poirier [mailto:mathieu.poirier at linaro.org]
> Sent: 27 November 2017 17:30
> To: Robert Walker <Robert.Walker@arm.com>
> Cc: linux-arm-kernel at lists.infradead.org; CoreSight at lists.linaro.org
> Subject: Re: [PATCH] coresight: Fix disabling of CoreSight TPIU
>
> Hi Robert,
>
> On 24 November 2017 at 02:58, Robert Walker <robert.walker@arm.com>
> wrote:
> > The CoreSight TPIU should be disabled when tracing to other sinks to
> > allow them to operate at full bandwidth.
> >
> > This patch fixes tpiu_disable_hw() to correctly disable the TPIU by
> > configuring the TPIU to stop on flush, initiating a manual flush,
> > waiting for the flush to complete and then waits for the TPIU to
> > indicate it has stopped.
> >
> > Signed-off-by: Robert Walker <robert.walker@arm.com>
> > ---
> > drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++---
> > 1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c
> > b/drivers/hwtracing/coresight/coresight-tpiu.c
> > index bef49a3..4b46c49 100644
> > --- a/drivers/hwtracing/coresight/coresight-tpiu.c
> > +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
> > @@ -46,8 +46,11 @@
> > #define TPIU_ITATBCTR0 0xef8
> >
> > /** register definition **/
> > +/* FFSR - 0x300 */
> > +#define FFSR_FT_STOPPED BIT(1)
> > /* FFCR - 0x304 */
> > #define FFCR_FON_MAN BIT(6)
> > +#define FFCR_STOP_FI BIT(12)
> >
> > /**
> > * @base: memory mapped base address for this component.
> > @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata
> > *drvdata) {
> > CS_UNLOCK(drvdata->base);
> >
> > - /* Clear formatter controle reg. */
> > - writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
> > + /* Clear formatter and stop on flush */
> > + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
> > /* Generate manual flush */
> > - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
> > + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base +
> TPIU_FFCR);
> > + /* Wait for flush to complete */
> > + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
> > + /* Wait for formatter to stop */
> > + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED,
> > + 1);
> >
> > CS_LOCK(drvdata->base);
> > }
>
> Shouldn't we also do this at boot time when the TPIU in _probed() ?
> That way the TPIU doesn't have to explicitly be enabled and disabled prior to
> running other tracing sessions.
>
> Thanks,
> Mathieu
There already is a call to tpiu_disable_hw() in tpiu_probe(), so the TPIU is disabled on boot.
When tracing to another sink (e.g. ETR), the TPIU won't be enabled / disabled (i.e. tpiu_enable_hw() and tpiu_disable_hw() won't be called) as it's not on the direct path from source to sink.
Regards
Rob
>
>
> > --
> > 1.9.1
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] coresight: Fix disabling of CoreSight TPIU
2017-11-28 8:55 ` Robert Walker
@ 2017-11-28 15:24 ` Mathieu Poirier
0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2017-11-28 15:24 UTC (permalink / raw)
To: linux-arm-kernel
On 28 November 2017 at 01:55, Robert Walker <robert.walker@arm.com> wrote:
> Hi Mathieu,
>
>> -----Original Message-----
>> From: Mathieu Poirier [mailto:mathieu.poirier at linaro.org]
>> Sent: 27 November 2017 17:30
>> To: Robert Walker <Robert.Walker@arm.com>
>> Cc: linux-arm-kernel at lists.infradead.org; CoreSight at lists.linaro.org
>> Subject: Re: [PATCH] coresight: Fix disabling of CoreSight TPIU
>>
>> Hi Robert,
>>
>> On 24 November 2017 at 02:58, Robert Walker <robert.walker@arm.com>
>> wrote:
>> > The CoreSight TPIU should be disabled when tracing to other sinks to
>> > allow them to operate at full bandwidth.
>> >
>> > This patch fixes tpiu_disable_hw() to correctly disable the TPIU by
>> > configuring the TPIU to stop on flush, initiating a manual flush,
>> > waiting for the flush to complete and then waits for the TPIU to
>> > indicate it has stopped.
>> >
>> > Signed-off-by: Robert Walker <robert.walker@arm.com>
>> > ---
>> > drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++---
>> > 1 file changed, 10 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c
>> > b/drivers/hwtracing/coresight/coresight-tpiu.c
>> > index bef49a3..4b46c49 100644
>> > --- a/drivers/hwtracing/coresight/coresight-tpiu.c
>> > +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
>> > @@ -46,8 +46,11 @@
>> > #define TPIU_ITATBCTR0 0xef8
>> >
>> > /** register definition **/
>> > +/* FFSR - 0x300 */
>> > +#define FFSR_FT_STOPPED BIT(1)
>> > /* FFCR - 0x304 */
>> > #define FFCR_FON_MAN BIT(6)
>> > +#define FFCR_STOP_FI BIT(12)
>> >
>> > /**
>> > * @base: memory mapped base address for this component.
>> > @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata
>> > *drvdata) {
>> > CS_UNLOCK(drvdata->base);
>> >
>> > - /* Clear formatter controle reg. */
>> > - writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
>> > + /* Clear formatter and stop on flush */
>> > + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
>> > /* Generate manual flush */
>> > - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
>> > + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base +
>> TPIU_FFCR);
>> > + /* Wait for flush to complete */
>> > + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
>> > + /* Wait for formatter to stop */
>> > + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED,
>> > + 1);
>> >
>> > CS_LOCK(drvdata->base);
>> > }
>>
>> Shouldn't we also do this at boot time when the TPIU in _probed() ?
>> That way the TPIU doesn't have to explicitly be enabled and disabled prior to
>> running other tracing sessions.
>>
>> Thanks,
>> Mathieu
>
> There already is a call to tpiu_disable_hw() in tpiu_probe(), so the TPIU is disabled on boot.
Nothing has happened on the TPIU side since I first re-worked the
driver, thanks for the reminder.
> When tracing to another sink (e.g. ETR), the TPIU won't be enabled / disabled (i.e. tpiu_enable_hw() and tpiu_disable_hw() won't be called) as it's not on the direct path from source to sink.
Right, that part is of no concern to me.
>
> Regards
>
> Rob
>
>>
>>
>> > --
>> > 1.9.1
>> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] coresight: Fix disabling of CoreSight TPIU
2017-11-24 9:58 [PATCH] coresight: Fix disabling of CoreSight TPIU Robert Walker
2017-11-27 17:30 ` Mathieu Poirier
@ 2017-12-07 16:14 ` Mike Leach
2017-12-07 16:39 ` Mathieu Poirier
1 sibling, 1 reply; 6+ messages in thread
From: Mike Leach @ 2017-12-07 16:14 UTC (permalink / raw)
To: linux-arm-kernel
Tested by: Mike Leach <mike.leach@linaro.org>
On 24 November 2017 at 09:58, Robert Walker <robert.walker@arm.com> wrote:
> The CoreSight TPIU should be disabled when tracing to other sinks to allow
> them to operate at full bandwidth.
>
> This patch fixes tpiu_disable_hw() to correctly disable the TPIU by
> configuring the TPIU to stop on flush, initiating a manual flush, waiting
> for the flush to complete and then waits for the TPIU to indicate it has
> stopped.
>
> Signed-off-by: Robert Walker <robert.walker@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
> index bef49a3..4b46c49 100644
> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
> @@ -46,8 +46,11 @@
> #define TPIU_ITATBCTR0 0xef8
>
> /** register definition **/
> +/* FFSR - 0x300 */
> +#define FFSR_FT_STOPPED BIT(1)
> /* FFCR - 0x304 */
> #define FFCR_FON_MAN BIT(6)
> +#define FFCR_STOP_FI BIT(12)
>
> /**
> * @base: memory mapped base address for this component.
> @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
> {
> CS_UNLOCK(drvdata->base);
>
> - /* Clear formatter controle reg. */
> - writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
> + /* Clear formatter and stop on flush */
> + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
> /* Generate manual flush */
> - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
> + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
> + /* Wait for flush to complete */
> + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
> + /* Wait for formatter to stop */
> + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
>
> CS_LOCK(drvdata->base);
> }
> --
> 1.9.1
>
> _______________________________________________
> CoreSight mailing list
> CoreSight at lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/coresight
--
Mike Leach
Principal Engineer, ARM Ltd.
Blackburn Design Centre. UK
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] coresight: Fix disabling of CoreSight TPIU
2017-12-07 16:14 ` Mike Leach
@ 2017-12-07 16:39 ` Mathieu Poirier
0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2017-12-07 16:39 UTC (permalink / raw)
To: linux-arm-kernel
On 7 December 2017 at 09:14, Mike Leach <mike.leach@linaro.org> wrote:
> Tested by: Mike Leach <mike.leach@linaro.org>
>
> On 24 November 2017 at 09:58, Robert Walker <robert.walker@arm.com> wrote:
>> The CoreSight TPIU should be disabled when tracing to other sinks to allow
>> them to operate at full bandwidth.
>>
>> This patch fixes tpiu_disable_hw() to correctly disable the TPIU by
>> configuring the TPIU to stop on flush, initiating a manual flush, waiting
>> for the flush to complete and then waits for the TPIU to indicate it has
>> stopped.
>>
>> Signed-off-by: Robert Walker <robert.walker@arm.com>
>> ---
>> drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
>> index bef49a3..4b46c49 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
>> @@ -46,8 +46,11 @@
>> #define TPIU_ITATBCTR0 0xef8
>>
>> /** register definition **/
>> +/* FFSR - 0x300 */
>> +#define FFSR_FT_STOPPED BIT(1)
>> /* FFCR - 0x304 */
>> #define FFCR_FON_MAN BIT(6)
>> +#define FFCR_STOP_FI BIT(12)
>>
>> /**
>> * @base: memory mapped base address for this component.
>> @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
>> {
>> CS_UNLOCK(drvdata->base);
>>
>> - /* Clear formatter controle reg. */
>> - writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
>> + /* Clear formatter and stop on flush */
>> + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
>> /* Generate manual flush */
>> - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
>> + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
>> + /* Wait for flush to complete */
>> + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
>> + /* Wait for formatter to stop */
>> + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
>>
>> CS_LOCK(drvdata->base);
>> }
>> --
>> 1.9.1
Applied - thanks.
Mathieu
>>
>> _______________________________________________
>> CoreSight mailing list
>> CoreSight at lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/coresight
>
>
>
> --
> Mike Leach
> Principal Engineer, ARM Ltd.
> Blackburn Design Centre. UK
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-07 16:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 9:58 [PATCH] coresight: Fix disabling of CoreSight TPIU Robert Walker
2017-11-27 17:30 ` Mathieu Poirier
2017-11-28 8:55 ` Robert Walker
2017-11-28 15:24 ` Mathieu Poirier
2017-12-07 16:14 ` Mike Leach
2017-12-07 16:39 ` Mathieu Poirier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.