coresight: Fix disabling of CoreSight TPIU
PATCH 1/1 coresight: Fix disabling of CoreSight TPIU
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.
--- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-tpiu.c +10 -3
@@ -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); }
Signature · 1 line
1.9.1
PATCH 1/1 coresight: Fix disabling of CoreSight TPIU
Hi Robert,
Quoted 37 lines · Robert Walker
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 <[email protected]>--- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tpiu.c +5
-2@@ -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 );
drivers/hwtracing/coresight/coresight-tpiu.c static void tpiu_disable_hw(struct tpiu_drvdata *drvdata) · line 101
Quoted 10 lines
drivers/hwtracing/coresight/coresight-tpiu.c +5
-1/* 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
Quoted 3 lines
--
1.9.1
PATCH 1/1 coresight: Fix disabling of CoreSight TPIU
Hi Mathieu,
Quoted 62 lines
-----Original Message-----
From: Mathieu Poirier [mailto:mathieu.poirier at linaro.org]
Sent: 27 November 2017 17:30
To: Robert Walker <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org; CoreSight at lists.linaro.org
Subject: Re: [PATCH] coresight: Fix disabling of CoreSight TPIUHi Robert,
Quoted 31 lines · Robert Walker
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 <[email protected]>--- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tpiu.c +3
-0@@ -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. drivers/hwtracing/coresight/coresight-tpiu.c static void tpiu_disable_hw(struct tpiu_drvdata · line 94
Quoted 10 lines
drivers/hwtracing/coresight/coresight-tpiu.c +3
-3@@ -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);drivers/hwtracing/coresight/coresight-tpiu.c static void tpiu_disable_hw(struct tpiu_drvdata *drvdata) · line 101
Quoted 8 lines
drivers/hwtracing/coresight/coresight-tpiu.c +5
-0+/* 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); }
Quoted 6 lines
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
Quoted 5 lines
Quoted 5 lines
--
1.9.1
PATCH 1/1 coresight: Fix disabling of CoreSight TPIU
Quoted 64 lines · Robert Walker
Hi Mathieu,
Quoted 62 lines
-----Original Message-----
From: Mathieu Poirier [mailto:mathieu.poirier at linaro.org]
Sent: 27 November 2017 17:30
To: Robert Walker <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org; CoreSight at lists.linaro.org
Subject: Re: [PATCH] coresight: Fix disabling of CoreSight TPIUHi Robert,
Quoted 31 lines · Robert Walker
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 <[email protected]>--- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tpiu.c +3
-0@@ -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. drivers/hwtracing/coresight/coresight-tpiu.c static void tpiu_disable_hw(struct tpiu_drvdata · line 94
Quoted 10 lines
drivers/hwtracing/coresight/coresight-tpiu.c +3
-3@@ -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);Quoted 8 lines
drivers/hwtracing/coresight/coresight-tpiu.c +5
-0+/* 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); }
Quoted 8 lines
Quoted 6 lines
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,
MathieuThere already is a call to
tpiu_disable_hw()intpiu_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.
Quoted 1 line
When tracing to another sink (e.g. ETR), the TPIU won't be enabled / disabled (i.e.
tpiu_enable_hw()andtpiu_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.
Quoted 11 lines
Regards
Rob
Quoted 5 lines
Quoted 5 lines
--
1.9.1
PATCH 1/1 coresight: Fix disabling of CoreSight TPIU
In reply to Robert WalkerTested by: Mike Leach <[email protected]>
Quoted 54 lines · Robert Walker
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 <[email protected]>--- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tpiu.c +10
-4@@ -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
Signature · 3 lines
Mike Leach Principal Engineer, ARM Ltd. Blackburn Design Centre. UK
PATCH 1/1 coresight: Fix disabling of CoreSight TPIU
Quoted 48 lines · Mike Leach
Tested by: Mike Leach <[email protected]>
Quoted 45 lines · Robert Walker
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 <[email protected]>--- drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tpiu.c +10
-3@@ -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 );
Quoted 4 lines
Quoted 4 lines
drivers/hwtracing/coresight/coresight-tpiu.c +0
-1CS_LOCK (drvdata->base); } --1.9.1
Applied - thanks.
Mathieu
Quoted 12 lines
Quoted 5 lines
_______________________________________________
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