Re: [PATCH 1/2] arm/omap3: a driver for on-chip ETM and ETB
2009/10/10 Shilimkar, Santosh santosh.shilim...@ti.com: -Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- ow...@vger.kernel.org] On Behalf Of virtu...@slind.org Sent: Thursday, October 08, 2009 3:06 AM To: linux-omap@vger.kernel.org Cc: Alexander Shishkin Subject: [PATCH 1/2] arm/omap3: a driver for on-chip ETM and ETB From: Alexander Shishkin virtu...@slind.org This driver implements /dev/tracebuf and some control files for ETM and ETB in sysfs. Looks like a very useful driver for tracing/debug. Do you have some README link on the usage of this driver ? Well, here's a brief intro into how to collect traces and decode them: http://wiki.github.com/virtuoso/etm2human/quickstart That's not much, but if you have any questions, just email them to me and I'll try to update the page. Regards, -- Alex -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/2] arm/omap3: a driver for on-chip ETM and ETB
-Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- ow...@vger.kernel.org] On Behalf Of virtu...@slind.org Sent: Thursday, October 08, 2009 3:06 AM To: linux-omap@vger.kernel.org Cc: Alexander Shishkin Subject: [PATCH 1/2] arm/omap3: a driver for on-chip ETM and ETB From: Alexander Shishkin virtu...@slind.org This driver implements /dev/tracebuf and some control files for ETM and ETB in sysfs. Looks like a very useful driver for tracing/debug. Do you have some README link on the usage of this driver ? Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/Kconfig.debug|8 + arch/arm/include/asm/hardware/coresight.h | 164 arch/arm/kernel/Makefile |2 + arch/arm/kernel/etm.c | 584 + arch/arm/mach-omap2/Kconfig |7 + arch/arm/mach-omap2/Makefile |3 + arch/arm/mach-omap2/emu.c | 70 7 files changed, 838 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/hardware/coresight.h create mode 100644 arch/arm/kernel/etm.c create mode 100644 arch/arm/mach-omap2/emu.c diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 1a6f70e..ac83c03 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -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 + tristate 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 diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h new file mode 100644 index 000..ba22df9 --- /dev/null +++ b/arch/arm/include/asm/hardware/coresight.h @@ -0,0 +1,164 @@ +/* + * linux/arch/arm/include/asm/hardware/coresight.h + * + * CoreSight components' registers + * + * 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. + */ + +#ifndef __ASM_HARDWARE_CORESIGHT_H +#define __ASM_HARDWARE_CORESIGHT_H + +#define TRACER_ACCESSED_BIT 0 +#define TRACER_RUNNING_BIT 1 +#define TRACER_CYCLE_ACC_BIT 2 +#define TRACER_ACCESSED BIT(TRACER_ACCESSED_BIT) +#define TRACER_RUNNING BIT(TRACER_RUNNING_BIT) +#define TRACER_CYCLE_ACC BIT(TRACER_CYCLE_ACC_BIT) + +struct tracectx { + unsigned int etb_bufsz; + void __iomem *etb_regs; + void __iomem *etm_regs; + unsigned long flags; + int ncmppairs; + int etm_portsz; + struct device *dev; + struct mutex mutex; +}; + +#define TRACER_TIMEOUT 1 + +#define etm_writel(t, v, x) \ + (__raw_writel((v), (t)-etm_regs + (x))) +#define etm_readl(t, x) (__raw_readl((t)-etm_regs + (x))) + +/* CoreSight Management Registers */ +#define CSMR_LOCKACCESS 0xfb0 +#define CSMR_LOCKSTATUS 0xfb4 +#define CSMR_AUTHSTATUS 0xfb8 +#define CSMR_DEVID 0xfc8 +#define CSMR_DEVTYPE 0xfcc +/* CoreSight Component Registers */ +#define CSCR_CLASS 0xff4 + +#define CSCR_PRSR0x314 + +#define UNLOCK_MAGIC 0xc5acce55 + +/* ETM control register, ETM Architecture, 3.3.1 */ +#define ETMR_CTRL0 +#define ETMCTRL_POWERDOWN1 +#define ETMCTRL_PROGRAM (1 10) +#define ETMCTRL_PORTSEL (1 11) +#define ETMCTRL_DO_CONTEXTID (3 14) +#define ETMCTRL_PORTMASK1(7 4) +#define ETMCTRL_PORTMASK2(1 21) +#define ETMCTRL_PORTMASK (ETMCTRL_PORTMASK1 | ETMCTRL_PORTMASK2) +#define ETMCTRL_PORTSIZE(x) x) 7) 4) | (!!((x) 8)) 21) +#define ETMCTRL_DO_CPRT (1 1) +#define ETMCTRL_DATAMASK (3 2) +#define ETMCTRL_DATA_DO_DATA (1 2) +#define ETMCTRL_DATA_DO_ADDR (1 3) +#define ETMCTRL_DATA_DO_BOTH (ETMCTRL_DATA_DO_DATA | ETMCTRL_DATA_DO_ADDR) +#define ETMCTRL_BRANCH_OUTPUT(1 8) +#define ETMCTRL_CYCLEACCURATE(1 12) + +/* ETM configuration code register */ +#define ETMR_CONFCODE(0x04) + +/* ETM trace start/stop resource control register */ +#define ETMR_TRACESSCTRL (0x18) + +/* ETM trigger event register */ +#define ETMR_TRIGEVT (0x08) + +/* address access type register bits, ETM architecture, + * table 3-27 */ +/* - access type */ +#define ETMAAT_IFETCH0 +#define ETMAAT_IEXEC 1 +#define ETMAAT_IEXECPASS 2 +#define ETMAAT_IEXECFAIL 3 +#define
Re: [PATCH 1/2] arm/omap3: a driver for on-chip ETM and ETB
* virtu...@slind.org virtu...@slind.org [091007 15:38]: From: Alexander Shishkin virtu...@slind.org This driver implements /dev/tracebuf and some control files for ETM and ETB in sysfs. Cool. This should go in via the linux-arm-kernel list, can you please resend? Please also Cc linux-omap list too. Regards, Tony Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/Kconfig.debug|8 + arch/arm/include/asm/hardware/coresight.h | 164 arch/arm/kernel/Makefile |2 + arch/arm/kernel/etm.c | 584 + arch/arm/mach-omap2/Kconfig |7 + arch/arm/mach-omap2/Makefile |3 + arch/arm/mach-omap2/emu.c | 70 7 files changed, 838 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/hardware/coresight.h create mode 100644 arch/arm/kernel/etm.c create mode 100644 arch/arm/mach-omap2/emu.c diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 1a6f70e..ac83c03 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -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 + tristate 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 diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h new file mode 100644 index 000..ba22df9 --- /dev/null +++ b/arch/arm/include/asm/hardware/coresight.h @@ -0,0 +1,164 @@ +/* + * linux/arch/arm/include/asm/hardware/coresight.h + * + * CoreSight components' registers + * + * 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. + */ + +#ifndef __ASM_HARDWARE_CORESIGHT_H +#define __ASM_HARDWARE_CORESIGHT_H + +#define TRACER_ACCESSED_BIT 0 +#define TRACER_RUNNING_BIT 1 +#define TRACER_CYCLE_ACC_BIT 2 +#define TRACER_ACCESSED BIT(TRACER_ACCESSED_BIT) +#define TRACER_RUNNING BIT(TRACER_RUNNING_BIT) +#define TRACER_CYCLE_ACC BIT(TRACER_CYCLE_ACC_BIT) + +struct tracectx { + unsigned int etb_bufsz; + void __iomem *etb_regs; + void __iomem *etm_regs; + unsigned long flags; + int ncmppairs; + int etm_portsz; + struct device *dev; + struct mutex mutex; +}; + +#define TRACER_TIMEOUT 1 + +#define etm_writel(t, v, x) \ + (__raw_writel((v), (t)-etm_regs + (x))) +#define etm_readl(t, x) (__raw_readl((t)-etm_regs + (x))) + +/* CoreSight Management Registers */ +#define CSMR_LOCKACCESS 0xfb0 +#define CSMR_LOCKSTATUS 0xfb4 +#define CSMR_AUTHSTATUS 0xfb8 +#define CSMR_DEVID 0xfc8 +#define CSMR_DEVTYPE 0xfcc +/* CoreSight Component Registers */ +#define CSCR_CLASS 0xff4 + +#define CSCR_PRSR0x314 + +#define UNLOCK_MAGIC 0xc5acce55 + +/* ETM control register, ETM Architecture, 3.3.1 */ +#define ETMR_CTRL0 +#define ETMCTRL_POWERDOWN1 +#define ETMCTRL_PROGRAM (1 10) +#define ETMCTRL_PORTSEL (1 11) +#define ETMCTRL_DO_CONTEXTID (3 14) +#define ETMCTRL_PORTMASK1(7 4) +#define ETMCTRL_PORTMASK2(1 21) +#define ETMCTRL_PORTMASK (ETMCTRL_PORTMASK1 | ETMCTRL_PORTMASK2) +#define ETMCTRL_PORTSIZE(x) x) 7) 4) | (!!((x) 8)) 21) +#define ETMCTRL_DO_CPRT (1 1) +#define ETMCTRL_DATAMASK (3 2) +#define ETMCTRL_DATA_DO_DATA (1 2) +#define ETMCTRL_DATA_DO_ADDR (1 3) +#define ETMCTRL_DATA_DO_BOTH (ETMCTRL_DATA_DO_DATA | ETMCTRL_DATA_DO_ADDR) +#define ETMCTRL_BRANCH_OUTPUT(1 8) +#define ETMCTRL_CYCLEACCURATE(1 12) + +/* ETM configuration code register */ +#define ETMR_CONFCODE(0x04) + +/* ETM trace start/stop resource control register */ +#define ETMR_TRACESSCTRL (0x18) + +/* ETM trigger event register */ +#define ETMR_TRIGEVT (0x08) + +/* address access type register bits, ETM architecture, + * table 3-27 */ +/* - access type */ +#define ETMAAT_IFETCH0 +#define ETMAAT_IEXEC 1 +#define ETMAAT_IEXECPASS 2 +#define ETMAAT_IEXECFAIL 3 +#define ETMAAT_DLOADSTORE4 +#define ETMAAT_DLOAD 5 +#define ETMAAT_DSTORE6 +/* - comparison access size */ +#define ETMAAT_JAVA (0 3) +#define ETMAAT_THUMB (1 3) +#define ETMAAT_ARM
[PATCH 1/2] arm/omap3: a driver for on-chip ETM and ETB
From: Alexander Shishkin virtu...@slind.org This driver implements /dev/tracebuf and some control files for ETM and ETB in sysfs. Signed-off-by: Alexander Shishkin virtu...@slind.org --- arch/arm/Kconfig.debug|8 + arch/arm/include/asm/hardware/coresight.h | 164 arch/arm/kernel/Makefile |2 + arch/arm/kernel/etm.c | 584 + arch/arm/mach-omap2/Kconfig |7 + arch/arm/mach-omap2/Makefile |3 + arch/arm/mach-omap2/emu.c | 70 7 files changed, 838 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/hardware/coresight.h create mode 100644 arch/arm/kernel/etm.c create mode 100644 arch/arm/mach-omap2/emu.c diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 1a6f70e..ac83c03 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -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 + tristate 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 diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h new file mode 100644 index 000..ba22df9 --- /dev/null +++ b/arch/arm/include/asm/hardware/coresight.h @@ -0,0 +1,164 @@ +/* + * linux/arch/arm/include/asm/hardware/coresight.h + * + * CoreSight components' registers + * + * 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. + */ + +#ifndef __ASM_HARDWARE_CORESIGHT_H +#define __ASM_HARDWARE_CORESIGHT_H + +#define TRACER_ACCESSED_BIT0 +#define TRACER_RUNNING_BIT 1 +#define TRACER_CYCLE_ACC_BIT 2 +#define TRACER_ACCESSEDBIT(TRACER_ACCESSED_BIT) +#define TRACER_RUNNING BIT(TRACER_RUNNING_BIT) +#define TRACER_CYCLE_ACC BIT(TRACER_CYCLE_ACC_BIT) + +struct tracectx { + unsigned int etb_bufsz; + void __iomem *etb_regs; + void __iomem *etm_regs; + unsigned long flags; + int ncmppairs; + int etm_portsz; + struct device *dev; + struct mutex mutex; +}; + +#define TRACER_TIMEOUT 1 + +#define etm_writel(t, v, x) \ + (__raw_writel((v), (t)-etm_regs + (x))) +#define etm_readl(t, x) (__raw_readl((t)-etm_regs + (x))) + +/* CoreSight Management Registers */ +#define CSMR_LOCKACCESS 0xfb0 +#define CSMR_LOCKSTATUS 0xfb4 +#define CSMR_AUTHSTATUS 0xfb8 +#define CSMR_DEVID 0xfc8 +#define CSMR_DEVTYPE 0xfcc +/* CoreSight Component Registers */ +#define CSCR_CLASS 0xff4 + +#define CSCR_PRSR 0x314 + +#define UNLOCK_MAGIC 0xc5acce55 + +/* ETM control register, ETM Architecture, 3.3.1 */ +#define ETMR_CTRL 0 +#define ETMCTRL_POWERDOWN 1 +#define ETMCTRL_PROGRAM(1 10) +#define ETMCTRL_PORTSEL(1 11) +#define ETMCTRL_DO_CONTEXTID (3 14) +#define ETMCTRL_PORTMASK1 (7 4) +#define ETMCTRL_PORTMASK2 (1 21) +#define ETMCTRL_PORTMASK (ETMCTRL_PORTMASK1 | ETMCTRL_PORTMASK2) +#define ETMCTRL_PORTSIZE(x) x) 7) 4) | (!!((x) 8)) 21) +#define ETMCTRL_DO_CPRT(1 1) +#define ETMCTRL_DATAMASK (3 2) +#define ETMCTRL_DATA_DO_DATA (1 2) +#define ETMCTRL_DATA_DO_ADDR (1 3) +#define ETMCTRL_DATA_DO_BOTH (ETMCTRL_DATA_DO_DATA | ETMCTRL_DATA_DO_ADDR) +#define ETMCTRL_BRANCH_OUTPUT (1 8) +#define ETMCTRL_CYCLEACCURATE (1 12) + +/* ETM configuration code register */ +#define ETMR_CONFCODE (0x04) + +/* ETM trace start/stop resource control register */ +#define ETMR_TRACESSCTRL (0x18) + +/* ETM trigger event register */ +#define ETMR_TRIGEVT (0x08) + +/* address access type register bits, ETM architecture, + * table 3-27 */ +/* - access type */ +#define ETMAAT_IFETCH 0 +#define ETMAAT_IEXEC 1 +#define ETMAAT_IEXECPASS 2 +#define ETMAAT_IEXECFAIL 3 +#define ETMAAT_DLOADSTORE 4 +#define ETMAAT_DLOAD 5 +#define ETMAAT_DSTORE 6 +/* - comparison access size */ +#define ETMAAT_JAVA(0 3) +#define ETMAAT_THUMB (1 3) +#define ETMAAT_ARM (3 3) +/* - data value comparison control */ +#define ETMAAT_NOVALCMP(0 5) +#define ETMAAT_VALMATCH(1 5) +#define ETMAAT_VALNOMATCH (3 5) +/* - exact match */ +#define ETMAAT_EXACTMATCH (1 7) +/* -