Skip to contentSkip to conversation

arm: a driver for on-chip ETM and ETB

PATCH Superseded Alexander Shishkin 3 participants 6 messages Oct 13, 2009 – Oct 19, 2009

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 arm: a driver for on-chip ETM and ETB

This driver implements support for on-chip Embedded Tracing Macrocell and Embedded Trace Buffer. It allows to trigger tracing of kernel execution flow and exporting trace output to userspace via character device and a sysrq combo.

Trace output can then be decoded by a fairly simple open source tool [1] which is already sufficient to get the idea of what the kernel is doing.

[1]: http://github.com/virtuoso/etm2human

---
Changes:
v2 -- major update:
* fixes according to comments from Linus Walleij and Anand Gadiyar
* omap3 clock-related stuff moved to platform device
v1 -- fixed comments from Juha Leppanen
v0 -- initial implementation, has been sent to linux-omap only

 arch/arm/Kconfig.debug                    |    8 +
 arch/arm/include/asm/hardware/coresight.h |  164 ++++++++
 arch/arm/kernel/Makefile                  |    2 +
 arch/arm/kernel/etm.c                     |  593 +++++++++++++++++++++++++++++
 4 files changed, 767 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/hardware/coresight.h
 create mode 100644 arch/arm/kernel/etm.c
arch/arm/Kconfig.debug +8 -0
index 1a6f70e..3c20e7f 100644
@@ -83,6 +83,14 @@ config DEBUG_ICEDCC
 	  It does include a timeout to ensure that the system does not
 	  totally freeze when there is nothing connected to read.
 
+config OC_ETM
+	bool "On-chip ETM and ETB"
+	depends on ARCH_OMAP3
+	help
+	  Enables the on-chip embedded trace macrocell and embedded trace
+	  buffer driver that will allow you to collect traces of the
+	  kernel code.
+
 config DEBUG_DC21285_PORT
 	bool "Kernel low-level debugging messages via footbridge serial port"
 	depends on DEBUG_LL && FOOTBRIDGE
arch/arm/include/asm/hardware/coresight.h new file +164 -0

164 lines not on this page · raw message

arch/arm/kernel/Makefile +2 -0
index 79087dd..e7ccf7e 100644
@@ -17,6 +17,8 @@ obj-y		:= compat.o elf.o entry-armv.o entry-common.o irq.o \
 		   process.o ptrace.o return_address.o setup.o signal.o \
 		   sys_arm.o stacktrace.o time.o traps.o
 
+obj-$(CONFIG_OC_ETM)		+= etm.o
+
 obj-$(CONFIG_ISA_DMA_API)	+= dma.o
 obj-$(CONFIG_ARCH_ACORN)	+= ecard.o 
 obj-$(CONFIG_FIQ)		+= fiq.o
arch/arm/kernel/etm.c new file +593 -0

593 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v2 2/2 OMAP3: add platform devices for ETM and ETB

This enables on-chip tracing components found in omap3xxx.

---
Changes:
v2 -- use emu_src clock for etb; feed it from sys_ck

 arch/arm/mach-omap2/Kconfig  |    7 +++
 arch/arm/mach-omap2/Makefile |    3 +
 arch/arm/mach-omap2/emu.c    |   95 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/emu.c
arch/arm/mach-omap2/Kconfig +7 -0
index 15cb529..4fbbb39 100644
@@ -96,3 +96,10 @@ config MACH_OMAP_ZOOM2
 config MACH_OMAP_4430SDP
 	bool "OMAP 4430 SDP board"
 	depends on ARCH_OMAP4
+
+config OMAP3_EMU
+	bool "OMAP3 debugging peripherals"
+	depends on ARCH_OMAP3 && OC_ETM
+	help
+	  Say Y here to enable debugging hardware of omap3
+
arch/arm/mach-omap2/Makefile +3 -0
index 9e63562..d1e172b 100644
@@ -44,6 +44,9 @@ obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
 obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
 
+# EMU periferals
+obj-$(CONFIG_OMAP3_EMU)		+= emu.o
+
 iommu-y					+= iommu2.o
 iommu-$(CONFIG_ARCH_OMAP3)		+= omap3-iommu.o
 
arch/arm/mach-omap2/emu.c new file +95 -0

95 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#2 lore raw

PATCH v2 1/2 arm: a driver for on-chip ETM and ETB

In reply to Alexander Shishkin
Quoted 4 lines · Alexander Shishkin

Changes:
v2 -- major update:
* fixes according to comments from Linus Walleij and Anand Gadiyar
* omap3 clock-related stuff moved to platform device

And so what about my comments?

#3 lore raw

PATCH v2 1/2 arm: a driver for on-chip ETM and ETB

2009/10/13 Russell King - ARM Linux <[email protected]>:

Quoted 7 lines · Alexander Shishkin
Quoted 4 lines

Changes:
v2 -- major update:
      * fixes according to comments from Linus Walleij and Anand Gadiyar
      * omap3 clock-related stuff moved to platform device

And so what about my comments?

Ah, sorry about that. It was just that the same comments were given by Linus, so my reply regarding those was to him.

Generally, my concern was that to make not all of the ETM versions even have a memory-mapped registers (earlier versions use cp14 instead; I don't support those at the moment, but it might be a nice thing to do that in future) and some of the registers which the AMBA framework seems to rely (peripheral id and component id) on are only available since ETMv3.2. And the most recent version mentioned in "ETM architecture" document is 3.4.

That said, I'm personally not overly concerned about the support for earlier versions of those macrocells and if you maintain that those are better off implemented as AMBA drivers, I've not problem doing that.

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH v2 1/2 arm: a driver for on-chip ETM and ETB

2009/10/19 Alexander Shishkin <[email protected]>:

Quoted 4 lines

That said, I'm personally not overly concerned about the support for earlier versions of those macrocells and if you maintain that those are better off implemented as AMBA drivers, I've not problem doing that.

If people are using older versions, they can hardcode the peripheral ID when they define the AMBA device in their board setup. This effectively deactivates the probe for device ID:s.

So it's safe to use the AMBA PrimeCell abstraction anyway.

Linus Walleij

#5 lore raw

PATCH v2 1/2 arm: a driver for on-chip ETM and ETB

In reply to Alexander Shishkin

arch/arm/kernel/etm.c line 368

Quoted 4 lines · Alexander Shishkin
arch/arm/kernel/etm.c new file +4 -0
+	emu_clk = *(struct clk **)pdev->dev.platform_data;
+	if (emu_clk)
+		clk_enable(emu_clk);
+

Definitely no way this is going to be acceptable. Never EVER pass clk pointers around like this.

And you've ignored the comments about it being a platform driver.

Sorry, but the answer to this patch is a firm NAK.

Please make it an AMBA primecell driver. Also make it follow the clk API correctly, and claim the three clocks for that primecell *only*.