Skip to contentSkip to conversation

arm: a driver for on-chip ETM and ETB

PATCH In review Alexander Shishkin 3 participants 6 messages Oct 22, 2009 – Dec 1, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 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:
v3 -- major update:
* switched from platform device to AMBA device
* started using clk API in a more proper way
* changed omap3 Kconfig part to select the driver instead of depending on it
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 |  165 ++++++++
 arch/arm/kernel/Makefile                  |    2 +
 arch/arm/kernel/etm.c                     |  641 +++++++++++++++++++++++++++++
 4 files changed, 816 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..ff54c23 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"
+	select ARM_AMBA
+	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 +165 -0

165 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 +641 -0

641 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v3 2/2 OMAP3: add AMBA devices for ETM and ETB

This enables on-chip tracing components found in omap3xxx.

---
 arch/arm/mach-omap2/Kconfig     |    8 +++++
 arch/arm/mach-omap2/Makefile    |    3 ++
 arch/arm/mach-omap2/clock34xx.c |    8 ++--
 arch/arm/mach-omap2/emu.c       |   66 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-omap2/emu.c
arch/arm/mach-omap2/Kconfig +8 -0
index 15cb529..f50d5bc 100644
@@ -96,3 +96,11 @@ config MACH_OMAP_ZOOM2
 config MACH_OMAP_4430SDP
 	bool "OMAP 4430 SDP board"
 	depends on ARCH_OMAP4
+
+config OMAP3_EMU
+	bool "OMAP3 tracing peripherals"
+	depends on ARCH_OMAP3
+	select OC_ETM
+	help
+	  Say Y here to enable tracing hardware of omap3
+
arch/arm/mach-omap2/Makefile +3 -0
index 954693c..c0ceb8c 100644
@@ -46,6 +46,9 @@ obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
 obj-$(CONFIG_OMAP_PM_SRF)		+=  resource34xx.o
 
+# EMU peripherals
+obj-$(CONFIG_OMAP3_EMU)		+= emu.o
+
 iommu-y					+= iommu2.o
 iommu-$(CONFIG_ARCH_OMAP3)		+= omap3-iommu.o
 
arch/arm/mach-omap2/clock34xx.c +4 -4
index da5bc1f..59d4320 100644
@@ -123,7 +123,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X),
 	CLK(NULL,	"dpll3_m3_ck",	&dpll3_m3_ck,	CK_343X),
 	CLK(NULL,	"dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X),
-	CLK(NULL,	"emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
+	CLK("etb",	"emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
 	CLK(NULL,	"dpll4_ck",	&dpll4_ck,	CK_343X),
 	CLK(NULL,	"dpll4_x2_ck",	&dpll4_x2_ck,	CK_343X),
 	CLK(NULL,	"omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X),
@@ -142,7 +142,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X),
 	CLK(NULL,	"dpll4_m6_ck",	&dpll4_m6_ck,	CK_343X),
 	CLK(NULL,	"dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X),
-	CLK(NULL,	"emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
+	CLK("etb",	"emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
 	CLK(NULL,	"dpll5_ck",	&dpll5_ck,	CK_3430ES2),
 	CLK(NULL,	"dpll5_m2_ck",	&dpll5_m2_ck,	CK_3430ES2),
 	CLK(NULL,	"clkout2_src_ck", &clkout2_src_ck, CK_343X),
@@ -151,7 +151,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"dpll1_fck",	&dpll1_fck,	CK_343X),
 	CLK(NULL,	"mpu_ck",	&mpu_ck,	CK_343X),
 	CLK(NULL,	"arm_fck",	&arm_fck,	CK_343X),
-	CLK(NULL,	"emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
+	CLK("etb",	"emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
 	CLK(NULL,	"dpll2_fck",	&dpll2_fck,	CK_343X),
 	CLK(NULL,	"iva2_ck",	&iva2_ck,	CK_343X),
 	CLK(NULL,	"l3_ick",	&l3_ick,	CK_343X),
@@ -306,7 +306,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK("omap-mcbsp.2", "fck",	&mcbsp2_fck,	CK_343X),
 	CLK("omap-mcbsp.3", "fck",	&mcbsp3_fck,	CK_343X),
 	CLK("omap-mcbsp.4", "fck",	&mcbsp4_fck,	CK_343X),
-	CLK(NULL,	"emu_src_ck",	&emu_src_ck,	CK_343X),
+	CLK("etb",	"emu_src_ck",	&emu_src_ck,	CK_343X),
 	CLK(NULL,	"pclk_fck",	&pclk_fck,	CK_343X),
 	CLK(NULL,	"pclkx2_fck",	&pclkx2_fck,	CK_343X),
 	CLK(NULL,	"atclk_fck",	&atclk_fck,	CK_343X),
arch/arm/mach-omap2/emu.c new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.6.3.3
maintainer
#2 lore raw

PATCH v3 2/2 OMAP3: add AMBA devices for ETM and ETB

Quoted 3 lines · Alexander Shishkin

This enables on-chip tracing components found in omap3xxx.

This should not cause any merge issues with the pending omap header changes, so let's merge this via Russell's queue along with the other ETM patches.

Quoted 157 lines
---
 arch/arm/mach-omap2/Kconfig     |    8 +++++
 arch/arm/mach-omap2/Makefile    |    3 ++
 arch/arm/mach-omap2/clock34xx.c |    8 ++--
 arch/arm/mach-omap2/emu.c       |   66 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-omap2/emu.c
arch/arm/mach-omap2/Kconfig +8 -0
index 15cb529..f50d5bc 100644
@@ -96,3 +96,11 @@ config MACH_OMAP_ZOOM2
 config MACH_OMAP_4430SDP
 	bool "OMAP 4430 SDP board"
 	depends on ARCH_OMAP4
+
+config OMAP3_EMU
+	bool "OMAP3 tracing peripherals"
+	depends on ARCH_OMAP3
+	select OC_ETM
+	help
+	  Say Y here to enable tracing hardware of omap3
+
arch/arm/mach-omap2/Makefile +3 -0
index 954693c..c0ceb8c 100644
@@ -46,6 +46,9 @@ obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
 obj-$(CONFIG_OMAP_PM_SRF)		+=  resource34xx.o
 
+# EMU peripherals
+obj-$(CONFIG_OMAP3_EMU)		+= emu.o
+
 iommu-y					+= iommu2.o
 iommu-$(CONFIG_ARCH_OMAP3)		+= omap3-iommu.o
 
arch/arm/mach-omap2/clock34xx.c +4 -4
index da5bc1f..59d4320 100644
@@ -123,7 +123,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X),
 	CLK(NULL,	"dpll3_m3_ck",	&dpll3_m3_ck,	CK_343X),
 	CLK(NULL,	"dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X),
-	CLK(NULL,	"emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
+	CLK("etb",	"emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
 	CLK(NULL,	"dpll4_ck",	&dpll4_ck,	CK_343X),
 	CLK(NULL,	"dpll4_x2_ck",	&dpll4_x2_ck,	CK_343X),
 	CLK(NULL,	"omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X),
@@ -142,7 +142,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X),
 	CLK(NULL,	"dpll4_m6_ck",	&dpll4_m6_ck,	CK_343X),
 	CLK(NULL,	"dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X),
-	CLK(NULL,	"emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
+	CLK("etb",	"emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
 	CLK(NULL,	"dpll5_ck",	&dpll5_ck,	CK_3430ES2),
 	CLK(NULL,	"dpll5_m2_ck",	&dpll5_m2_ck,	CK_3430ES2),
 	CLK(NULL,	"clkout2_src_ck", &clkout2_src_ck, CK_343X),
@@ -151,7 +151,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"dpll1_fck",	&dpll1_fck,	CK_343X),
 	CLK(NULL,	"mpu_ck",	&mpu_ck,	CK_343X),
 	CLK(NULL,	"arm_fck",	&arm_fck,	CK_343X),
-	CLK(NULL,	"emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
+	CLK("etb",	"emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
 	CLK(NULL,	"dpll2_fck",	&dpll2_fck,	CK_343X),
 	CLK(NULL,	"iva2_ck",	&iva2_ck,	CK_343X),
 	CLK(NULL,	"l3_ick",	&l3_ick,	CK_343X),
@@ -306,7 +306,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK("omap-mcbsp.2", "fck",	&mcbsp2_fck,	CK_343X),
 	CLK("omap-mcbsp.3", "fck",	&mcbsp3_fck,	CK_343X),
 	CLK("omap-mcbsp.4", "fck",	&mcbsp4_fck,	CK_343X),
-	CLK(NULL,	"emu_src_ck",	&emu_src_ck,	CK_343X),
+	CLK("etb",	"emu_src_ck",	&emu_src_ck,	CK_343X),
 	CLK(NULL,	"pclk_fck",	&pclk_fck,	CK_343X),
 	CLK(NULL,	"pclkx2_fck",	&pclkx2_fck,	CK_343X),
 	CLK(NULL,	"atclk_fck",	&atclk_fck,	CK_343X),
arch/arm/mach-omap2/emu.c new file +66 -0
new file mode 100644
index 0000000..ec0d984
@@ -0,0 +1,66 @@
+/*
+ * emu.c
+ *
+ * ETM and ETB CoreSight components' resources as found in OMAP3xxx.
+ *
+ * Copyright (C) 2009 Nokia Corporation.
+ * Alexander Shishkin
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/amba/bus.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alexander Shishkin");
+
+/* Cortex CoreSight components within omap3xxx EMU */
+#define ETM_BASE	(L4_EMU_34XX_PHYS + 0x10000)
+#define DBG_BASE	(L4_EMU_34XX_PHYS + 0x11000)
+#define ETB_BASE	(L4_EMU_34XX_PHYS + 0x1b000)
+#define DAPCTL		(L4_EMU_34XX_PHYS + 0x1d000)
+
+static struct amba_device omap3_etb_device = {
+	.dev		= {
+		.init_name = "etb",
+	},
+	.res		= {
+		.start	= ETB_BASE,
+		.end	= ETB_BASE + SZ_4K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	.periphid	= 0x000bb907,
+};
+
+static struct amba_device omap3_etm_device = {
+	.dev		= {
+		.init_name = "etm",
+	},
+	.res		= {
+		.start	= ETM_BASE,
+		.end	= ETM_BASE + SZ_4K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	.periphid	= 0x102bb921,
+};
+
+static int __init emu_init(void)
+{
+	amba_device_register(&omap3_etb_device, &iomem_resource);
+	amba_device_register(&omap3_etm_device, &iomem_resource);
+
+	return 0;
+}
+
+subsys_initcall(emu_init);
+
Signature · 6 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to Alexander Shishkin
Quoted 6 lines · Alexander Shishkin

Changes:
v3 -- major update:
* switched from platform device to AMBA device
* started using clk API in a more proper way
* changed omap3 Kconfig part to select the driver instead of depending on it

Russell, I believe this one addresses your concerns about my previous patches. Shall I wait for more comments from you or do you want me to upload them to your patch tracker?

Regards,
--
Alex

#4 lore raw

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

Quoted 11 lines · Alexander Shishkin
Quoted 6 lines · Alexander Shishkin

Changes:
v3 -- major update:
* switched from platform device to AMBA device
* started using clk API in a more proper way
* changed omap3 Kconfig part to select the driver instead of depending on it

Russell, I believe this one addresses your concerns about my previous patches. Shall I wait for more comments from you or do you want me to upload them to your patch tracker?

Alex, I suggest you to:

1. Double check that you really addressed _everything_ Russel and others pointed - may be this is the reason why your patch is stuck.

2. If you have addressed everything, upload the patch to the patch system. My (very limited) experience was that I re-sent a patch several times, got no response for long time, but then Russel simply asked me to upload it, and it was merged. Thus, the silence may simply mean "upload to the patch system".

HTH.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)
#5 lore raw
Quoted 15 lines · Artem Bityutskiy
Quoted 11 lines · Alexander Shishkin
Quoted 6 lines · Alexander Shishkin

Changes:
v3 -- major update:
* switched from platform device to AMBA device
* started using clk API in a more proper way
* changed omap3 Kconfig part to select the driver instead of depending on it

Russell, I believe this one addresses your concerns about my previous patches. Shall I wait for more comments from you or do you want me to upload them to your patch tracker?

Alex, I suggest you to:

Quoted 8 lines

1. Double check that you really addressed _everything_ Russel and others pointed - may be this is the reason why your patch is stuck.

2. If you have addressed everything, upload the patch to the patch system. My (very limited) experience was that I re-sent a patch several times, got no response for long time, but then Russel simply asked me to upload it, and it was merged. Thus, the silence may simply mean "upload to the patch system".

Thanks for the hint. I've double checked the patches and I'm fairly sure I have addressed all of the concerns expressed to the best of my ability. So I did as you said: uploaded the patches to the patch tracker.

Regards,
--
Alex