Skip to contentSkip to conversation

CoreSight framework and drivers

RFC New pratikp at codeaurora.org 6 participants 32 messages Dec 18, 2012 – Feb 21, 2013

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

This RFC is aimed at introducing CoreSight framework as well as individual CoreSight trace component drivers adhering to ARM CoreSight specification. Some prior discussion on this can be referred at [1].

There are 3 kinds of CoreSight trace components:

* Sources: Responsible for producing trace data to provide visibility for the associated entity.

* Links: Transport components that carry trace data.

* Sinks: Collectors for storing trace data or acting as conduits for off-chip trace data collection.

These components can be connected in various topologies to suite a particular SoCs tracing needs.

Framework is responsible for gathering and using the information about the registered CoreSight components and their connections to allow it to dynamically deduce the sequence of components representing a connection from a CoreSight source to the currently selected CoreSight sink. This helps the framework to program the correct set of components to satisfy user request.

[1] http://comments.gmane.org/gmane.linux.ports.arm.kernel/204591

Pratik Patel (8):
coresight: add CoreSight core layer framework
coresight: add CoreSight TMC driver
coresight: add CoreSight TPIU driver
coresight: add CoreSight ETB driver
coresight: add CoreSight Funnel driver
coresight: add CoreSight Replicator driver
coresight: add CoreSight STM driver
coresight: add CoreSight ETM driver

 Documentation/devicetree/bindings/arm/coresight.txt |  110 ++
 arch/arm/include/asm/hardware/cp14.h                |  540 ++++++
 drivers/Kconfig                                     |    2 +
 drivers/Makefile                                    |    1 +
 drivers/coresight/Kconfig                           |   60 +
 drivers/coresight/Makefile                          |    8 +
 drivers/coresight/coresight-etb.c                   |  467 +++++
 drivers/coresight/coresight-etm-cp14.c              |  510 ++++++
 drivers/coresight/coresight-etm.c                   | 1752 +++++++++++++++++++
 drivers/coresight/coresight-funnel.c                |  260 +++
 drivers/coresight/coresight-priv.h                  |   48 +
 drivers/coresight/coresight-replicator.c            |  211 +++
 drivers/coresight/coresight-stm.c                   |  819 +++++++++
 drivers/coresight/coresight-tmc.c                   |  794 +++++++++
 drivers/coresight/coresight-tpiu.c                  |  232 +++
 drivers/coresight/coresight.c                       |  681 +++++++
 drivers/coresight/of_coresight.c                    |   99 ++
 include/linux/coresight-stm.h                       |   51 +
 include/linux/coresight.h                           |  167 ++
 include/linux/of_coresight.h                        |   27 +
 20 files changed, 6839 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/coresight.txt
 create mode 100644 arch/arm/include/asm/hardware/cp14.h
 create mode 100644 drivers/coresight/Kconfig
 create mode 100644 drivers/coresight/Makefile
 create mode 100644 drivers/coresight/coresight-etb.c
 create mode 100644 drivers/coresight/coresight-etm-cp14.c
 create mode 100644 drivers/coresight/coresight-etm.c
 create mode 100644 drivers/coresight/coresight-funnel.c
 create mode 100644 drivers/coresight/coresight-priv.h
 create mode 100644 drivers/coresight/coresight-replicator.c
 create mode 100644 drivers/coresight/coresight-stm.c
 create mode 100644 drivers/coresight/coresight-tmc.c
 create mode 100644 drivers/coresight/coresight-tpiu.c
 create mode 100644 drivers/coresight/coresight.c
 create mode 100644 drivers/coresight/of_coresight.c
 create mode 100644 include/linux/coresight-stm.h
 create mode 100644 include/linux/coresight.h
 create mode 100644 include/linux/of_coresight.h
#1 lore raw

RFC 1/8 coresight: add CoreSight core layer framework

From: Pratik Patel <[email protected]>

CoreSight components are compliant with the ARM CoreSight architecture specification and can be connected in various topologies to suite a particular SoCs tracing needs. These trace components can generally be classified as sources, links and sinks. Trace data produced by one or more sources flows through the intermediate links connecting the source to the currently selected sink.

CoreSight framework provides an interface for the CoreSight trace drivers to register themselves with. It's intended to build up a topological view of the CoreSight components and configure the right series of components on user input via sysfs.

For eg., when enabling a source, framework builds up a path consisting of all the components connecting the source to the currently selected sink and enables all of them.

Framework also supports switching between available sinks and also provides status information to user space applications through sysfs interface.

---
 .../devicetree/bindings/arm/coresight.txt          |  106 +++
 drivers/Kconfig                                    |    2 +
 drivers/Makefile                                   |    1 +
 drivers/coresight/Kconfig                          |    9 +
 drivers/coresight/Makefile                         |    5 +
 drivers/coresight/coresight-priv.h                 |   48 ++
 drivers/coresight/coresight.c                      |  681 ++++++++++++++++++++
 drivers/coresight/of_coresight.c                   |   99 +++
 include/linux/coresight.h                          |  167 +++++
 include/linux/of_coresight.h                       |   27 +
 10 files changed, 1145 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/coresight.txt
 create mode 100644 drivers/coresight/Kconfig
 create mode 100644 drivers/coresight/Makefile
 create mode 100644 drivers/coresight/coresight-priv.h
 create mode 100644 drivers/coresight/coresight.c
 create mode 100644 drivers/coresight/of_coresight.c
 create mode 100644 include/linux/coresight.h
 create mode 100644 include/linux/of_coresight.h
Documentation/devicetree/bindings/arm/coresight.txt new file +106 -0
new file mode 100644
index 0000000..c584073
@@ -0,0 +1,106 @@
+* CoreSight Components
+
+CoreSight components are compliant with the ARM CoreSight architecture
+specification and can be connected in various topologies to suite a particular
+SoCs tracing needs. These trace components can generally be classified as sinks,
+links and sources. Trace data produced by one or more sources flows through the
+intermediate links connecting the source to the currently selected sink. Each
+CoreSight component device should use these properties to describe its hardware
+characteristcs.
+
+Required properties:
+
+- compatible : name of the component used for driver matching
+- reg : physical base address and length of the register set(s) of the component
+- coresight-id : unique integer identifier for the component
+- coresight-name : unique descriptive name of the component
+- coresight-nr-inports : number of input ports on the component
+
+coresight-outports, coresight-child-list and coresight-child-ports lists will
+be of the same length and will have a one to one correspondence among the
+elements at the same list index.
+
+coresight-default-sink must be specified for one of the sink devices that is
+intended to be made the default sink. Other sink devices must not have this
+specified. Not specifying this property on any of the sinks is invalid.
+
+Optional properties:
+
+- coresight-outports : list of output port numbers of this component
+- coresight-child-list : list of phandles pointing to the children of this
+			 component
+- coresight-child-ports : list of input port numbers of the children
+- coresight-default-sink : represents the default compile time CoreSight sink
+
+Examples:
+
+1. Sinks
+	tmc_etr: tmc at fc322000 {
+		compatible = "arm,coresight-tmc";
+		reg = <0xfc322000 0x1000>;
+
+		coresight-id = <0>;
+		coresight-name = "coresight-tmc-etr";
+		coresight-nr-inports = <1>;
+		coresight-default-sink;
+	};
+
+	tpiu: tpiu at fc318000 {
+		compatible = "arm,coresight-tpiu";
+		reg = <0xfc318000 0x1000>;
+
+		coresight-id = <1>;
+		coresight-name = "coresight-tpiu";
+		coresight-nr-inports = <1>;
+	};
+
+2. Links
+	funnel_merg: funnel at fc31b000 {
+		compatible = "arm,coresight-funnel";
+		reg = <0xfc31b000 0x1000>;
+
+		coresight-id = <4>;
+		coresight-name = "coresight-funnel-merg";
+		coresight-nr-inports = <2>;
+		coresight-outports = <0>;
+		coresight-child-list = <&tmc_etf>;
+		coresight-child-ports = <0>;
+	};
+
+	funnel_in0: funnel at fc319000 {
+		compatible = "arm,coresight-funnel";
+		reg = <0xfc319000 0x1000>;
+
+		coresight-id = <5>;
+		coresight-name = "coresight-funnel-in0";
+		coresight-nr-inports = <8>;
+		coresight-outports = <0>;
+		coresight-child-list = <&funnel_merg>;
+		coresight-child-ports = <0>;
+	};
+
+3. Sources
+	stm: stm at fc321000 {
+		compatible = "arm,coresight-stm";
+		reg = <0xfc321000 0x1000>,
+		      <0xfa280000 0x180000>;
+
+		coresight-id = <9>;
+		coresight-name = "coresight-stm";
+		coresight-nr-inports = <0>;
+		coresight-outports = <0>;
+		coresight-child-list = <&funnel_in1>;
+		coresight-child-ports = <7>;
+	};
+
+	etm0: etm at fc33c000 {
+		compatible = "arm,coresight-etm";
+		reg = <0xfc33c000 0x1000>;
+
+		coresight-id = <10>;
+		coresight-name = "coresight-etm0";
+		coresight-nr-inports = <0>;
+		coresight-outports = <0>;
+		coresight-child-list = <&funnel_kpss>;
+		coresight-child-ports = <0>;
+	};
drivers/Kconfig +2 -0
index dbdefa3..9b6f810 100644
@@ -156,4 +156,6 @@ source "drivers/pwm/Kconfig"
 
 source "drivers/irqchip/Kconfig"
 
+source "drivers/coresight/Kconfig"
+
 endmenu
drivers/Makefile +1 -0
index a16a8d0..4650105 100644
@@ -145,3 +145,4 @@ obj-$(CONFIG_EXTCON)		+= extcon/
 obj-$(CONFIG_MEMORY)		+= memory/
 obj-$(CONFIG_IIO)		+= iio/
 obj-$(CONFIG_VME_BUS)		+= vme/
+obj-$(CONFIG_CORESIGHT) 	+= coresight/
drivers/coresight/Kconfig new file +9 -0
new file mode 100644
index 0000000..65279c4
@@ -0,0 +1,9 @@
+menuconfig CORESIGHT
+	bool "CoreSight Tracing Support"
+	help
+	  This framework provides an interface for the CoreSight debug and
+	  trace drivers to register themselves with. It's intended to build
+	  up a topological view of the CoreSight components and configure
+	  the right series of components on user input via sysfs. It also
+	  provides status information to user space applications through
+	  sysfs interface.
drivers/coresight/Makefile new file +5 -0
new file mode 100644
index 0000000..218e3b5
@@ -0,0 +1,5 @@
+#
+# Makefile for CoreSight drivers.
+#
+obj-$(CONFIG_CORESIGHT) += coresight.o
+obj-$(CONFIG_OF) += of_coresight.o
drivers/coresight/coresight-priv.h new file +48 -0

48 lines not on this page · raw message

drivers/coresight/coresight.c new file +681 -0

681 lines not on this page · raw message

drivers/coresight/of_coresight.c new file +99 -0

99 lines not on this page · raw message

include/linux/coresight.h new file +167 -0

167 lines not on this page · raw message

include/linux/of_coresight.h new file +27 -0
new file mode 100644
index 0000000..6a5e4d4
@@ -0,0 +1,27 @@
+/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __LINUX_OF_CORESIGHT_H
+#define __LINUX_OF_CORESIGHT_H
+
+#ifdef CONFIG_OF
+extern struct coresight_platform_data *of_get_coresight_platform_data(
+				struct device *dev, struct device_node *node);
+#else
+static inline struct coresight_platform_data *of_get_coresight_platform_data(
+				struct device *dev, struct device_node *node)
+{
+	return NULL;
+}
+#endif
+
+#endif
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#2 lore raw

RFC 2/8 coresight: add CoreSight TMC driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight TMC (Trace Memory Controller) which can act as a link or a sink depending upon its configuration. It can present itself as an ETF (Embedded Trace FIFO) or ETR (Embedded Trace Router).

ETF when configured in circular buffer mode acts as a trace collection sink. When configured in HW fifo mode it acts as link. ETR always acts as a sink and can be used to route data to memory allocated in RAM.

---
 .../devicetree/bindings/arm/coresight.txt          |    2 +
 drivers/coresight/Kconfig                          |   11 +
 drivers/coresight/Makefile                         |    1 +
 drivers/coresight/coresight-tmc.c                  |  794 ++++++++++++++++++++
 4 files changed, 808 insertions(+), 0 deletions(-)
 create mode 100644 drivers/coresight/coresight-tmc.c
Documentation/devicetree/bindings/arm/coresight.txt +2 -0
index c584073..031f760 100644
@@ -31,6 +31,7 @@ Optional properties:
 			 component
 - coresight-child-ports : list of input port numbers of the children
 - coresight-default-sink : represents the default compile time CoreSight sink
+- arm,buffer-size : size of contiguous buffer space for TMC ETR
 
 Examples:
 
@@ -43,6 +44,7 @@ Examples:
 		coresight-name = "coresight-tmc-etr";
 		coresight-nr-inports = <1>;
 		coresight-default-sink;
+		arm,buffer-size = <0x100000>;
 	};
 
 	tpiu: tpiu at fc318000 {
drivers/coresight/Kconfig +11 -0
index 65279c4..6905ef2 100644
@@ -7,3 +7,14 @@ menuconfig CORESIGHT
 	  the right series of components on user input via sysfs. It also
 	  provides status information to user space applications through
 	  sysfs interface.
+
+if CORESIGHT
+
+config CORESIGHT_LINKS_AND_SINKS
+	bool "CoreSight Link and Sink drivers"
+	help
+	  This enables support for CoreSight link and sink drivers that are
+	  responsible for transporting and collecting the trace data
+	  respectively.
+
+endif
drivers/coresight/Makefile +1 -0
index 218e3b5..16e26c5 100644
@@ -3,3 +3,4 @@
 #
 obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
+obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o
drivers/coresight/coresight-tmc.c new file +794 -0

794 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#3 lore raw

RFC 2/8 coresight: add CoreSight TMC driver

There is something fishy here.

Quoted 17 lines
drivers/coresight/coresight-tmc.c new file +17 -0
+static void __tmc_etb_dump(struct tmc_drvdata *drvdata)
+{
+	enum tmc_mem_intf_width memwidth;
+	uint8_t memwords;
+	char *bufp;
+	uint32_t read_data;
+	int i;
+
+	memwidth = BMVAL(tmc_readl(drvdata, CORESIGHT_DEVID), 8, 10);
+	if (memwidth == TMC_MEM_INTF_WIDTH_32BITS)
+		memwords = 1;
+	else if (memwidth == TMC_MEM_INTF_WIDTH_64BITS)
+		memwords = 2;
+	else if (memwidth == TMC_MEM_INTF_WIDTH_128BITS)
+		memwords = 4;
+	else
+		memwords = 8;

drivers/coresight/coresight-tmc.c line 287

Quoted 10 lines
drivers/coresight/coresight-tmc.c new file +10 -0
+
+	bufp = drvdata->buf;
+	while (1) {
+		for (i = 0; i < memwords; i++) {
+			read_data = tmc_readl(drvdata, TMC_RRD);
+			if (read_data == 0xFFFFFFFF)
+				return;
+			memcpy(bufp, &read_data, BYTES_PER_WORD);
+			bufp += BYTES_PER_WORD;
+		}

This will loop for every if in ETB mode because it will trace the reading because we have not disabled it before this. So maybe disable it first and as a security check for buffer size you have it in the drvdata I think.

Quoted 8 lines
drivers/coresight/coresight-tmc.c new file +3 -1
+	}
+}
+
--

Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

BR
Robert

#4 lore raw

RFC 3/8 coresight: add CoreSight TPIU driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight TPIU (Trace Port Interface Unit) which acts as a sink. TPIU is typically connected to some offchip hardware hosting a storage buffer.

---
 drivers/coresight/Makefile         |    2 +-
 drivers/coresight/coresight-tpiu.c |  232 ++++++++++++++++++++++++++++++++++++
 2 files changed, 233 insertions(+), 1 deletions(-)
 create mode 100644 drivers/coresight/coresight-tpiu.c
drivers/coresight/Makefile +1 -1
index 16e26c5..540df99 100644
@@ -3,4 +3,4 @@
 #
 obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
-obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o
+obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o
drivers/coresight/coresight-tpiu.c new file +232 -0

232 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#5 lore raw

RFC 4/8 coresight: add CoreSight ETB driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight ETB (Embedded Trace Buffer) which acts as a circular buffer sink collecting generated trace data.

---
 drivers/coresight/Makefile        |    2 +-
 drivers/coresight/coresight-etb.c |  467 +++++++++++++++++++++++++++++++++++++
 2 files changed, 468 insertions(+), 1 deletions(-)
 create mode 100644 drivers/coresight/coresight-etb.c
drivers/coresight/Makefile +1 -1
index 540df99..3c1debc 100644
@@ -3,4 +3,4 @@
 #
 obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
-obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o
+obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o
drivers/coresight/coresight-etb.c new file +467 -0

467 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#6 lore raw

RFC 4/8 coresight: add CoreSight ETB driver

Quoted 10 lines · pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight ETB (Embedded Trace Buffer) which acts as a circular buffer sink collecting generated trace data.

---
 drivers/coresight/Makefile        |    2 +-
 drivers/coresight/coresight-etb.c |  467 +++++++++++++++++++++++++++++++++++++
 2 files changed, 468 insertions(+), 1 deletions(-)

[snip]

Quoted 40 lines
drivers/coresight/coresight-etb.c new file +40 -0
+static int __devinit etb_probe(struct platform_device *pdev)
+{
+	int ret;
+	struct device *dev = &pdev->dev;
+	struct coresight_platform_data *pdata;
+	struct etb_drvdata *drvdata;
+	struct resource *res;
+	struct coresight_desc *desc;
+
+	if (pdev->dev.of_node) {
+		pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node);
+		if (IS_ERR(pdata))
+			return PTR_ERR(pdata);
+		pdev->dev.platform_data = pdata;
+	}
+
+	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+	if (!drvdata)
+		return -ENOMEM;
+	drvdata->dev = &pdev->dev;
+	platform_set_drvdata(pdev, drvdata);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+	if (!drvdata->base)
+		return -ENOMEM;
+
+	spin_lock_init(&drvdata->spinlock);
+
+	drvdata->clk = devm_clk_get(dev, "core_clk");
+	if (IS_ERR(drvdata->clk))
+		return PTR_ERR(drvdata->clk);
+
+	ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
+	if (ret)
+		return ret;
+

drivers/coresight/coresight-etb.c line 405

Quoted 10 lines
drivers/coresight/coresight-etb.c new file +10 -0
+	drvdata->buf = devm_kzalloc(dev, ETB_SIZE_WORDS * BYTES_PER_WORD,
+				    GFP_KERNEL);
+	if (!drvdata->buf)
+		return -ENOMEM;
+
+	desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+	if (!desc)
+		return -ENOMEM;
+	desc->type = CORESIGHT_DEV_TYPE_SINK;
+	desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;

Can a source be directly connected to a sink or do you need to have a link in between?

The reason, I ask is because on some Cortex-A8 devices we have ETM directly connected to ETB and there is no link per-se to configure.

Cheers
Jon

#7 lore raw

RFC 4/8 coresight: add CoreSight ETB driver

Quoted 69 lines · Jon Hunter
Quoted 10 lines · pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight ETB (Embedded Trace Buffer) which acts as a circular buffer sink collecting generated trace data.

---
 drivers/coresight/Makefile        |    2 +-
 drivers/coresight/coresight-etb.c |  467 +++++++++++++++++++++++++++++++++++++
 2 files changed, 468 insertions(+), 1 deletions(-)

[snip]

Quoted 40 lines
drivers/coresight/coresight-etb.c new file +40 -0
+static int __devinit etb_probe(struct platform_device *pdev)
+{
+	int ret;
+	struct device *dev = &pdev->dev;
+	struct coresight_platform_data *pdata;
+	struct etb_drvdata *drvdata;
+	struct resource *res;
+	struct coresight_desc *desc;
+
+	if (pdev->dev.of_node) {
+		pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node);
+		if (IS_ERR(pdata))
+			return PTR_ERR(pdata);
+		pdev->dev.platform_data = pdata;
+	}
+
+	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+	if (!drvdata)
+		return -ENOMEM;
+	drvdata->dev = &pdev->dev;
+	platform_set_drvdata(pdev, drvdata);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+	if (!drvdata->base)
+		return -ENOMEM;
+
+	spin_lock_init(&drvdata->spinlock);
+
+	drvdata->clk = devm_clk_get(dev, "core_clk");
+	if (IS_ERR(drvdata->clk))
+		return PTR_ERR(drvdata->clk);
+
+	ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
+	if (ret)
+		return ret;
+

drivers/coresight/coresight-etb.c line 405

Quoted 10 lines
drivers/coresight/coresight-etb.c new file +10 -0
+	drvdata->buf = devm_kzalloc(dev, ETB_SIZE_WORDS * BYTES_PER_WORD,
+				    GFP_KERNEL);
+	if (!drvdata->buf)
+		return -ENOMEM;
+
+	desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+	if (!desc)
+		return -ENOMEM;
+	desc->type = CORESIGHT_DEV_TYPE_SINK;
+	desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;

Can a source be directly connected to a sink or do you need to have a link in between?

Quoted 3 lines

The reason, I ask is because on some Cortex-A8 devices we have ETM directly connected to ETB and there is no link per-se to configure.

Source can be directly connected to a sink. I believe the current code should be able to take care of that but I haven't tried it since we didn't have such a case.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#8 lore raw

RFC 5/8 coresight: add CoreSight Funnel driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight Funnel which acts as a link. Funnels have multiple input ports (typically 8) each of which represents an input trace data stream. These multiple input trace data streams are interleaved into a single output stream coming out of the Funnel.

---
 drivers/coresight/Makefile           |    2 +-
 drivers/coresight/coresight-funnel.c |  260 ++++++++++++++++++++++++++++++++++
 2 files changed, 261 insertions(+), 1 deletions(-)
 create mode 100644 drivers/coresight/coresight-funnel.c
drivers/coresight/Makefile +1 -1
index 3c1debc..9f84ad0 100644
@@ -3,4 +3,4 @@
 #
 obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
-obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o
+obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o coresight-funnel.o
drivers/coresight/coresight-funnel.c new file +260 -0

260 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#9 lore raw

RFC 6/8 coresight: add CoreSight Replicator driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight Replicator that takes single input trace data stream and replicates it to produce two identical trace data output streams. Replicators are typically used to route single interleaved trace data stream to two or more sinks.

---
 drivers/coresight/Makefile               |    2 +-
 drivers/coresight/coresight-replicator.c |  211 ++++++++++++++++++++++++++++++
 2 files changed, 212 insertions(+), 1 deletions(-)
 create mode 100644 drivers/coresight/coresight-replicator.c
drivers/coresight/Makefile +1 -1
index 9f84ad0..b385e81 100644
@@ -3,4 +3,4 @@
 #
 obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
-obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o coresight-funnel.o
+obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o coresight-funnel.o coresight-replicator.o
drivers/coresight/coresight-replicator.c new file +211 -0

211 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#10 lore raw

RFC 7/8 coresight: add CoreSight STM driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight STM (System Trace Macrocell) and provides apis and user interface to support software instrumentation based tracing that takes advantage of the STM hardware.

---
 drivers/coresight/Kconfig         |   19 +
 drivers/coresight/Makefile        |    1 +
 drivers/coresight/coresight-stm.c |  819 +++++++++++++++++++++++++++++++++++++
 include/linux/coresight-stm.h     |   51 +++
 4 files changed, 890 insertions(+), 0 deletions(-)
 create mode 100644 drivers/coresight/coresight-stm.c
 create mode 100644 include/linux/coresight-stm.h
drivers/coresight/Kconfig +19 -0
index 6905ef2..5a715e8 100644
@@ -17,4 +17,23 @@ config CORESIGHT_LINKS_AND_SINKS
 	  responsible for transporting and collecting the trace data
 	  respectively.
 
+config CORESIGHT_SOURCE_STM
+	bool "CoreSight System Trace Macrocell driver"
+	select CORESIGHT_LINKS_AND_SINKS
+	help
+	  This driver provides support for hardware assisted software
+	  instrumentation based tracing. This is primarily useful for
+	  logging useful software events or data.
+
+config CORESIGHT_SOURCE_STM_DEFAULT_ENABLE
+	bool "Turn on CoreSight STM tracing by default"
+	depends on CORESIGHT_SOURCE_STM
+	help
+	  Turns on CoreSight STM tracing (hardware assisted software
+	  instrumentation based tracing) by default. Otherwise, tracing is
+	  disabled by default but can be enabled via sysfs.
+
+	  If unsure, say 'N' here to avoid potential power, performance and
+	  memory penalty.
+
 endif
drivers/coresight/Makefile +1 -0
index b385e81..750aa7c 100644
@@ -4,3 +4,4 @@
 obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
 obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o coresight-funnel.o coresight-replicator.o
+obj-$(CONFIG_CORESIGHT_SOURCE_STM) += coresight-stm.o
drivers/coresight/coresight-stm.c new file +819 -0

819 lines not on this page · raw message

include/linux/coresight-stm.h new file +51 -0

51 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#11 lore raw

RFC 8/8 coresight: add CoreSight ETM driver

In reply to pratikp at codeaurora.org

From: Pratik Patel <[email protected]>

This driver manages CoreSight ETM (Embedded Trace Macrocell) that supports processor tracing. Currently it supports ARM PFT (Program Flow Trace) v1.1 specification but can be extended to support other ETM or PFT versions.

---
 .../devicetree/bindings/arm/coresight.txt          |    2 +
 arch/arm/include/asm/hardware/cp14.h               |  540 ++++++
 drivers/coresight/Kconfig                          |   21 +
 drivers/coresight/Makefile                         |    1 +
 drivers/coresight/coresight-etm-cp14.c             |  510 ++++++
 drivers/coresight/coresight-etm.c                  | 1752 ++++++++++++++++++++
 6 files changed, 2826 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/hardware/cp14.h
 create mode 100644 drivers/coresight/coresight-etm-cp14.c
 create mode 100644 drivers/coresight/coresight-etm.c
Documentation/devicetree/bindings/arm/coresight.txt +2 -0
index 031f760..e3efbe4 100644
@@ -32,6 +32,7 @@ Optional properties:
 - coresight-child-ports : list of input port numbers of the children
 - coresight-default-sink : represents the default compile time CoreSight sink
 - arm,buffer-size : size of contiguous buffer space for TMC ETR
+- arm,cp14 : cp14 access to ETM registers is implemented and should be used
 
 Examples:
 
@@ -105,4 +106,5 @@ Examples:
 		coresight-outports = <0>;
 		coresight-child-list = <&funnel_kpss>;
 		coresight-child-ports = <0>;
+		arm,cp14;
 	};
arch/arm/include/asm/hardware/cp14.h new file +540 -0

540 lines not on this page · raw message

drivers/coresight/Kconfig +21 -0
index 5a715e8..196f16b 100644
@@ -36,4 +36,25 @@ config CORESIGHT_SOURCE_STM_DEFAULT_ENABLE
 	  If unsure, say 'N' here to avoid potential power, performance and
 	  memory penalty.
 
+config CORESIGHT_SOURCE_ETM
+	bool "CoreSight Embedded Trace Macrocell driver"
+	depends on !OC_ETM
+	select CORESIGHT_LINKS_AND_SINKS
+	help
+	  This driver provides support for processor tracing which allows
+	  tracing the instructions that the processor is executing. This is
+	  primarily useful for instruction level tracing.
+
+
+config CORESIGHT_SOURCE_ETM_DEFAULT_ENABLE
+	bool "Turn on CoreSight ETM tracing by default"
+	depends on CORESIGHT_SOURCE_ETM
+	help
+	  Turns on CoreSight ETM tracing (processor tracing) by default.
+	  Otherwise, tracing is disabled by default but can be enabled via
+	  sysfs.
+
+	  If unsure, say 'N' here to avoid potential power, performance and
+	  memory penalty.
+
 endif
drivers/coresight/Makefile +1 -0
index 750aa7c..ccbbd59 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_CORESIGHT) += coresight.o
 obj-$(CONFIG_OF) += of_coresight.o
 obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-tmc.o coresight-tpiu.o coresight-etb.o coresight-funnel.o coresight-replicator.o
 obj-$(CONFIG_CORESIGHT_SOURCE_STM) += coresight-stm.o
+obj-$(CONFIG_CORESIGHT_SOURCE_ETM) += coresight-etm.o coresight-etm-cp14.o
drivers/coresight/coresight-etm-cp14.c new file +510 -0

510 lines not on this page · raw message

drivers/coresight/coresight-etm.c new file +1752 -0

1,752 lines not on this page · raw message

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#12 lore raw
In reply to pratikp at codeaurora.org

Hi Pratik,

Quoted 18 lines · pratikp at codeaurora.org

This RFC is aimed at introducing CoreSight framework as well as individual CoreSight trace component drivers adhering to ARM CoreSight specification. Some prior discussion on this can be referred at [1].

There are 3 kinds of CoreSight trace components:

* Sources: Responsible for producing trace data to provide visibility for the associated entity.

* Links: Transport components that carry trace data.

* Sinks: Collectors for storing trace data or acting as conduits for off-chip trace data collection.

These components can be connected in various topologies to suite a particular SoCs tracing needs.

Quoted 8 lines

Framework is responsible for gathering and using the information about the registered CoreSight components and their connections to allow it to dynamically deduce the sequence of components representing a connection from a CoreSight source to the currently selected CoreSight sink. This helps the framework to program the correct set of components to satisfy user request.

From a million miles up, this looks like a sensible sort of design but I

really think you need to talk to Jon Hunter (he's at least on CC) about this, especially where bindings are concerned. If we can get something that you both agree on, then we can include the CTI with the other coresight components and do a more in-depth review at that point.

Finally, how do you plan on exposing this data to the user? I think the only sane way is to have per-device file descriptors which act as pipes to the raw data but this means we need some readily available, open-source tooling (or at least public specifications of the trace formats).

Will

#13 lore raw
Quoted 28 lines · Will Deacon

Hi Pratik,

Quoted 18 lines · pratikp at codeaurora.org

This RFC is aimed at introducing CoreSight framework as well as individual CoreSight trace component drivers adhering to ARM CoreSight specification. Some prior discussion on this can be referred at [1].

There are 3 kinds of CoreSight trace components:

* Sources: Responsible for producing trace data to provide visibility for the associated entity.

* Links: Transport components that carry trace data.

* Sinks: Collectors for storing trace data or acting as conduits for off-chip trace data collection.

These components can be connected in various topologies to suite a particular SoCs tracing needs.

Quoted 6 lines

Framework is responsible for gathering and using the information about the registered CoreSight components and their connections to allow it to dynamically deduce the sequence of components representing a connection from a CoreSight source to the currently selected CoreSight sink. This helps the framework to program the correct set of components to satisfy user request.

Quoted 5 lines

From a million miles up, this looks like a sensible sort of design but I really think you need to talk to Jon Hunter (he's at least on CC) about this, especially where bindings are concerned. If we can get something that you both agree on, then we can include the CTI with the other coresight components and do a more in-depth review at that point.

I need to look at these in closer detail, but there are a couple high-level items that need to be aligned on which are ...

1. Why not use the AMBA bus framework?

You mentioned before that "AMBA bus is for PrimeCell devices (class 0xF) as opposed to CoreSight devices (class 0x9)". I will not claim to be that familiar with primecell and coresight devices and there differences, but this statement does not help me understand why a new bus type is needed. Furthermore, the existing ETM and ETB driver in arch/arm/kernel/etm.c uses the AMBA bus today and so at least those coresight devices are able to use the AMBA bus type.

2. What about the existing ETM/ETB drivers?

We have existing drivers for ETM and ETB in arch/arm/kernel/etm.c. We should either move those drivers to the drivers directory or replace them with the new one. However, no point in having two drivers for the same coresight device.

Cheers
Jon

#14 lore raw
Quoted 41 lines · Jon Hunter
Quoted 28 lines · Will Deacon

Hi Pratik,

Quoted 18 lines · pratikp at codeaurora.org

This RFC is aimed at introducing CoreSight framework as well as individual CoreSight trace component drivers adhering to ARM CoreSight specification. Some prior discussion on this can be referred at [1].

There are 3 kinds of CoreSight trace components:

* Sources: Responsible for producing trace data to provide visibility for the associated entity.

* Links: Transport components that carry trace data.

* Sinks: Collectors for storing trace data or acting as conduits for off-chip trace data collection.

These components can be connected in various topologies to suite a particular SoCs tracing needs.

Quoted 6 lines

Framework is responsible for gathering and using the information about the registered CoreSight components and their connections to allow it to dynamically deduce the sequence of components representing a connection from a CoreSight source to the currently selected CoreSight sink. This helps the framework to program the correct set of components to satisfy user request.

Quoted 5 lines

From a million miles up, this looks like a sensible sort of design but I really think you need to talk to Jon Hunter (he's at least on CC) about this, especially where bindings are concerned. If we can get something that you both agree on, then we can include the CTI with the other coresight components and do a more in-depth review at that point.

I need to look at these in closer detail, but there are a couple high-level items that need to be aligned on which are ...

1. Why not use the AMBA bus framework?

Quoted 8 lines

You mentioned before that "AMBA bus is for PrimeCell devices (class 0xF) as opposed to CoreSight devices (class 0x9)". I will not claim to be that familiar with primecell and coresight devices and there differences, but this statement does not help me understand why a new bus type is needed. Furthermore, the existing ETM and ETB driver in arch/arm/kernel/etm.c uses the AMBA bus today and so at least those coresight devices are able to use the AMBA bus type.

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

BTW, sorry the patches didn't get posted to the list since they are apparently awaiting moderator approval.

Quoted 7 lines

2. What about the existing ETM/ETB drivers?

We have existing drivers for ETM and ETB in arch/arm/kernel/etm.c. We should either move those drivers to the drivers directory or replace them with the new one. However, no point in having two drivers for the same coresight device.

Agree we should ensure we don't lose any existing functionality.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#15 lore raw

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

Cheers
Jon

#16 lore raw
Quoted 34 lines · Jon Hunter

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

Quoted 4 lines

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Quoted 15 lines

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

Quoted 8 lines

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

I had left the "None" type for miscellaneous stuff but I agree it should be a separate type - maybe "debug".

Having said that I like the CTI driver you have uploaded. Need to look at it in more detail. Since CTI connections can vary between chip to chip, we need a generic way to deal with it.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#17 lore raw

Hi Pratik,

Quoted 68 lines · Pratik Patel
Quoted 34 lines · Jon Hunter

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

Quoted 4 lines

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Quoted 15 lines

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

Quoted 8 lines

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

Quoted 6 lines

I had left the "None" type for miscellaneous stuff but I agree it should be a separate type - maybe "debug".

Having said that I like the CTI driver you have uploaded. Need to look at it in more detail. Since CTI connections can vary between chip to chip, we need a generic way to deal with it.

I am also interested to look at such a framework in order to have a clean implementation of the ETM, PMI/CMI (HW tracing IP on OMAP4+). I am currently busy on a driver for PMI/CMI which requires some configuration of the Coresight, ETM, ETB, ATB etc. IP blocks.

Could you send your patches to linux-arm and linux-omap mailing lists? I will be pleased to review them.

Regards,
Jean

Quoted 10 lines

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#18 lore raw
Quoted 77 lines · Jean Pihet

Hi Pratik,

Quoted 68 lines · Pratik Patel
Quoted 34 lines · Jon Hunter

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

Quoted 4 lines

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Quoted 15 lines

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

Quoted 8 lines

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

Quoted 6 lines

I had left the "None" type for miscellaneous stuff but I agree it should be a separate type - maybe "debug".

Having said that I like the CTI driver you have uploaded. Need to look at it in more detail. Since CTI connections can vary between chip to chip, we need a generic way to deal with it.

Quoted 8 lines

I am also interested to look at such a framework in order to have a clean implementation of the ETM, PMI/CMI (HW tracing IP on OMAP4+). I am currently busy on a driver for PMI/CMI which requires some configuration of the Coresight, ETM, ETB, ATB etc. IP blocks.

Could you send your patches to linux-arm and linux-omap mailing lists? I will be pleased to review them.

Thanks. I did post them to linux-arm-kernel but they are waiting on moderator approval. Hopefully they will get posted soon.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#19 lore raw
In reply to Pratik Patel
Quoted 35 lines · Pratik Patel
Quoted 34 lines · Jon Hunter

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

Quoted 8 lines
Quoted 4 lines

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Yes exactly. However, please note I am not saying that we should do this, and I asking what direction does the community want us to take here? Platform bus or AMBA bus?

Quoted 24 lines
Quoted 15 lines

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

Quoted 8 lines

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

Quoted 6 lines

I had left the "None" type for miscellaneous stuff but I agree it should be a separate type - maybe "debug".

Having said that I like the CTI driver you have uploaded. Need to look at it in more detail. Since CTI connections can vary between chip to chip, we need a generic way to deal with it.

Yes if you have any ideas let me know. As Will had mentioned it would be good to have a common function table all these devices could use too. I will take a closer look at what you have.

Cheers
Jon

#20 lore raw
Quoted 8 lines · Jon Hunter
Quoted 3 lines · Pratik Patel

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Yes exactly. However, please note I am not saying that we should do this, and I asking what direction does the community want us to take here? Platform bus or AMBA bus?

One of the issues which worries me about mixing peripheral drivers on random different buses is... what happens when we end up with a SoC which gates the APB clock at bus level (there are SoCs which gate the APB clock at peripheral level.) In other words, an APB bus only gets clocked upon request.

We can deal with that with the infrastructure we have in place in the AMBA bus layer, but not with the platform bus - we'd have to teach the platform bus driver about the special APB clock instead of having it handled primerily at the bus layer.

At least the coresight ETM peripherals make use of the APB bus. They have a whole pile of registers on the APB bus, and they have the primecell IDs stored in the last words of the peripheral, again just like the other primecell devices we have using the AMBA bus layer.

What I'd say is... why stick it on a different bus type from the other peripherals which might make things harder in the future?

#21 lore raw
Quoted 21 lines · Russell King - ARM Linux
Quoted 8 lines · Jon Hunter
Quoted 3 lines · Pratik Patel

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Yes exactly. However, please note I am not saying that we should do this, and I asking what direction does the community want us to take here? Platform bus or AMBA bus?

One of the issues which worries me about mixing peripheral drivers on random different buses is... what happens when we end up with a SoC which gates the APB clock at bus level (there are SoCs which gate the APB clock at peripheral level.) In other words, an APB bus only gets clocked upon request.

We can deal with that with the infrastructure we have in place in the AMBA bus layer, but not with the platform bus - we'd have to teach the platform bus driver about the special APB clock instead of having it handled primerily at the bus layer.

Quoted 7 lines

At least the coresight ETM peripherals make use of the APB bus. They have a whole pile of registers on the APB bus, and they have the primecell IDs stored in the last words of the peripheral, again just like the other primecell devices we have using the AMBA bus layer.

What I'd say is... why stick it on a different bus type from the other peripherals which might make things harder in the future?

Thanks for the info. I will look into using the AMBA bus instead of the platform bus but one issue I notice is that AMBA framework seems to support one contiguous register space.

CoreSight STM typically has a config register space and a stimulus port/channel register space and these can be non-contiguous in the chip memory map.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#22 lore raw
In reply to Jon Hunter
Quoted 77 lines · Jon Hunter
Quoted 35 lines · Pratik Patel
Quoted 34 lines · Jon Hunter

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

Quoted 8 lines
Quoted 4 lines

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Yes exactly. However, please note I am not saying that we should do this, and I asking what direction does the community want us to take here? Platform bus or AMBA bus?

Quoted 27 lines
Quoted 15 lines

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

Quoted 8 lines

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

I had left the "None" type for miscellaneous stuff but I agree it should be a separate type - maybe "debug".

Quoted 8 lines
Quoted 3 lines

Having said that I like the CTI driver you have uploaded. Need to look at it in more detail. Since CTI connections can vary between chip to chip, we need a generic way to deal with it.

Yes if you have any ideas let me know. As Will had mentioned it would be good to have a common function table all these devices could use too. I will take a closer look at what you have.

I had started on a CTI driver much in line with your current implementation but your approach looks good to me.

Looking at the code though, I couldn't find a way to perform a mapping between two different CTIs. Reason I ask is because we have use cases where we need to map one CTIs input to another CTIs output on the same channel.

Do you intend to support different entities within kernel to map different trig_in or trig_out on the same CTI? If so, it might probably require reference counting for the enable/disable.

What user interface do you plan to provide for the CTI? Maybe something consistent with other CoreSight components in sysfs to allow users to enable, disable, map and unmap ???

Please let me know your thoughts.

CTIs can easily be made part of the CoreSight core layer using a different type but apart from being part of the CoreSight list containing all the trace and CTI components, not sure if there is anything that is useful to do in the core layer. Need to think about this.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#23 lore raw
Quoted 5 lines · Pratik Patel

What user interface do you plan to provide for the CTI? Maybe something consistent with other CoreSight components in sysfs to allow users to enable, disable, map and unmap ???

Please let me know your thoughts.

Rather than have your current approach of dev nodes + sysfs config files for each coresight device, I think it might be better to follow something closer to ftrace and stick per-device directories under debugfs/coresight/. Then you can have a pipe file and some config files in the same directory for each component. You also don't need to do any mapping operations with this (just post-process the stream directly).

It might also be fun to play with file redirection for sources and sinks, but that's probably a bit too invasive.

Will

#24 lore raw
Quoted 5 lines · Will Deacon
Quoted 4 lines · Pratik Patel

What user interface do you plan to provide for the CTI? Maybe something consistent with other CoreSight components in sysfs to allow users to enable, disable, map and unmap ???

Quoted 9 lines
Quoted 1 line

Please let me know your thoughts.

Rather than have your current approach of dev nodes + sysfs config files for each coresight device, I think it might be better to follow something closer to ftrace and stick per-device directories under debugfs/coresight/. Then you can have a pipe file and some config files in the same directory for each component. You also don't need to do any mapping operations with this (just post-process the stream directly).

Thanks for the suggestion. I had initially debated between debugfs and sysfs but chose sysfs + dev nodes since using device attributes relieves the drivers from manually managing directories and files, its taken care of by the device and sysfs layers. Moreover, since these are physical devices, device attributes made sense at the time.

The map and unmap I was referring to was for the CTI trigger mappings. Dev nodes are currently intended to provide the raw data collected in the sinks.

Whats the advantage in using debugfs here?

Quoted 4 lines

It might also be fun to play with file redirection for sources and sinks, but that's probably a bit too invasive.

Will

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#25 lore raw
Quoted 23 lines · Pratik Patel
Quoted 5 lines · Will Deacon
Quoted 4 lines · Pratik Patel

What user interface do you plan to provide for the CTI? Maybe something consistent with other CoreSight components in sysfs to allow users to enable, disable, map and unmap ???

Quoted 9 lines
Quoted 1 line

Please let me know your thoughts.

Rather than have your current approach of dev nodes + sysfs config files for each coresight device, I think it might be better to follow something closer to ftrace and stick per-device directories under debugfs/coresight/. Then you can have a pipe file and some config files in the same directory for each component. You also don't need to do any mapping operations with this (just post-process the stream directly).

Thanks for the suggestion. I had initially debated between debugfs and sysfs but chose sysfs + dev nodes since using device attributes relieves the drivers from manually managing directories and files, its taken care of by the device and sysfs layers. Moreover, since these are physical devices, device attributes made sense at the time.

Quoted 5 lines

The map and unmap I was referring to was for the CTI trigger mappings. Dev nodes are currently intended to provide the raw data collected in the sinks.

Whats the advantage in using debugfs here?

The main things I like about debugfs are (a) it's a text-driven interface and easy to script with and (b) it matches what we do for ftrace.

Furthermore, it means that subtle differences between devices can be hidden in the driver and not require different vendor tools for parsing the trace data.

Will

#26 lore raw
Quoted 28 lines · Will Deacon
Quoted 27 lines · Pratik Patel
Quoted 5 lines · Will Deacon
Quoted 4 lines · Pratik Patel

What user interface do you plan to provide for the CTI? Maybe something consistent with other CoreSight components in sysfs to allow users to enable, disable, map and unmap ???

Quoted 9 lines
Quoted 1 line

Please let me know your thoughts.

Rather than have your current approach of dev nodes + sysfs config files for each coresight device, I think it might be better to follow something closer to ftrace and stick per-device directories under debugfs/coresight/. Then you can have a pipe file and some config files in the same directory for each component. You also don't need to do any mapping operations with this (just post-process the stream directly).

Thanks for the suggestion. I had initially debated between debugfs and sysfs but chose sysfs + dev nodes since using device attributes relieves the drivers from manually managing directories and files, its taken care of by the device and sysfs layers. Moreover, since these are physical devices, device attributes made sense at the time.

The map and unmap I was referring to was for the CTI trigger mappings. Dev nodes are currently intended to provide the raw data collected in the sinks.

Quoted 9 lines
Quoted 1 line

Whats the advantage in using debugfs here?

The main things I like about debugfs are (a) it's a text-driven interface and easy to script with and (b) it matches what we do for ftrace.

Furthermore, it means that subtle differences between devices can be hidden in the driver and not require different vendor tools for parsing the trace data.

Sorry for the delay and maybe I am missing something but it seems we can take care of such protocol or parsing/decoding differences even with device nodes since that seems independent of the interface used - per device debugfs attributes or per device device nodes.

CoreSight trace solution is typically a SoC wide solution and hence can get used by non-Linux processors or hardware. Using debugfs would imply compiling it and exposing all the debug knobs even if the use case was to use the CoreSight solution for something that didn't need all that.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#27 lore raw
Quoted 11 lines · Pratik Patel
Quoted 10 lines · Will Deacon
Quoted 1 line · Pratik Patel

Whats the advantage in using debugfs here?

The main things I like about debugfs are (a) it's a text-driven interface and easy to script with and (b) it matches what we do for ftrace.

Furthermore, it means that subtle differences between devices can be hidden in the driver and not require different vendor tools for parsing the trace data.

Quoted 5 lines

Sorry for the delay and maybe I am missing something but it seems we can take care of such protocol or parsing/decoding differences even with device nodes since that seems independent of the interface used - per device debugfs attributes or per device device nodes.

You seem to be arguing that the two interfaces are equivalent, in which case I say that we should follow ftrace's lead and use debugfs for this...

...but I still maintain that debugfs is also far easier to work with from userspace.

Quoted 5 lines

CoreSight trace solution is typically a SoC wide solution and hence can get used by non-Linux processors or hardware. Using debugfs would imply compiling it and exposing all the debug knobs even if the use case was to use the CoreSight solution for something that didn't need all that.

Many debug features require debugfs to be compiled, so I don't buy that as a show-stopping argument in favour of using dev nodes. I also think that exposing all of the debug knobs is actually a good thing, given the low-level nature of coresight devices (where we're offloading most of the knowledge to userspace anyway).

Will

#28 lore raw
In reply to Pratik Patel
Quoted 87 lines · Pratik Patel
Quoted 77 lines · Jon Hunter
Quoted 35 lines · Pratik Patel
Quoted 34 lines · Jon Hunter

On 12/19/2012 03:24 PM, Pratik Patel wrote:

[snip]

Quoted 12 lines

Currently we use the CoreSight virtual bus to conveniently list sysfs configuration attributes for all the registered CoreSight devices.

For eg:
/sys/bus/coresight/devices/coresight-etm0/<attribute> /sys/bus/coresight/devices/coresight-etm1/<attribute> /sys/bus/coresight/devices/coresight-stm/<attribute> /sys/bus/coresight/devices/coresight-tmc-etf/<attribute>
...
...

Quoted 7 lines

Some of the attributes are based on device type (i.e. source, link or sink) so they will exist for all devices of that type while some are device specific.

Maybe I am misunderstanding the question but are you suggesting to register CoreSight devices to the AMBA bus instead of the CoreSight core layer code?

Yes exactly.

Quoted 6 lines

Will Deacon mentioned earlier that AMBA framework can be changed to accomodate devices with a different class but I am more concerned with losing some of the stuff that the core layer code does (eg. coresight_register, coresight_enable, coresight_disable in coresight.c) if we register CoreSight drivers to the AMBA bus without letting the core layer know about the device connections.

Quoted 8 lines
Quoted 4 lines

I may be missing something, but couldn't you keep all the register/enable/disable stuff but just register the device with the amba bus? Obviously some changes would need to be made.

Ok, so are you referring to making CoreSight devices register with AMBA bus instead of platform bus keeping everything else intact?

Yes exactly. However, please note I am not saying that we should do this, and I asking what direction does the community want us to take here? Platform bus or AMBA bus?

Quoted 27 lines
Quoted 15 lines

Personally, I don't have strong feeling either way, but we have ETM/ETB drivers using AMBA today and so I am hoping we can come to agreement on this going forward.

Russell, Will, what are your thoughts?

Otherwise, looking at the code, I like what you have implemented. I still need to look closer, but I am struggling to figure out how a coresight device such as the cross-trigger-interface fits with this model. This model appears to be geared towards coresight devices used for traces purposes and are either source, links or sinks. The cross-trigger-interface is not a source or a sink. However, although you it could be considered as a link (routing events), it is not really, as it may not link to other coresight sinks/source.

Quoted 8 lines

In my case, I have PMU-IRQ --> CTI --> GIC. So a non-coresight source and sink. In away the CTI looks more like a 2nd-level interrupt controller than anything else. Hence, another type of coresight device may be needed in addition to source, links and sinks. Or link is extended in some way to connect to non-coresight sources/sinks.

Let me know if you have any thoughts.

I had left the "None" type for miscellaneous stuff but I agree it should be a separate type - maybe "debug".

Quoted 8 lines
Quoted 3 lines

Having said that I like the CTI driver you have uploaded. Need to look at it in more detail. Since CTI connections can vary between chip to chip, we need a generic way to deal with it.

Yes if you have any ideas let me know. As Will had mentioned it would be good to have a common function table all these devices could use too. I will take a closer look at what you have.

Quoted 7 lines

I had started on a CTI driver much in line with your current implementation but your approach looks good to me.

Looking at the code though, I couldn't find a way to perform a mapping between two different CTIs. Reason I ask is because we have use cases where we need to map one CTIs input to another CTIs output on the same channel.

The code is largely based upon the existing cti helpers, which just had a cti_map_trigger() function. The use-case you described is not supported by the current helpers and so also not supported in my initial implementation (although we should add this). Hence, it would be probably best to split the cti_map_trigger() into two functions say, cti_map_triggerin() and cti_map_triggerout(), to map a trigger input/output to a channel.

Quoted 3 lines

Do you intend to support different entities within kernel to map different trig_in or trig_out on the same CTI? If so, it might probably require reference counting for the enable/disable.

I need to think about this some more, as this does make it a little more complex. Right now only one entity can use a cti module at a time.

Quoted 3 lines

What user interface do you plan to provide for the CTI? Maybe something consistent with other CoreSight components in sysfs to allow users to enable, disable, map and unmap ???

Yes that's possible.

Quoted 7 lines

Please let me know your thoughts.

CTIs can easily be made part of the CoreSight core layer using a different type but apart from being part of the CoreSight list containing all the trace and CTI components, not sure if there is anything that is useful to do in the core layer. Need to think about this.

Yes it would be good to make this all part of the same coresight framework.

Cheers
Jon

#29 lore raw
Quoted 9 lines · Jon Hunter

The code is largely based upon the existing cti helpers, which just had a cti_map_trigger() function. The use-case you described is not supported by the current helpers and so also not supported in my initial implementation (although we should add this). Hence, it would be probably best to split the cti_map_trigger() into two functions say, cti_map_triggerin() and cti_map_triggerout(), to map a trigger input/output to a channel.

Yes, splitting the map function will provide more flexibility. One possibility is to cue the enable and disable functions from the mapping reference count for the CTI so that enable and disable are internal only functions.

In this case the flow would look something like:

cti_get(cti1)
cti_map_triggerin(cti1) -> enable cti1 cti_get(cti2)
cti_map_triggerin(cti2) -> enable cti2 cti_map_triggerout(cti1) -> increment cti1 refcount

cti_unmap_triggerin(cti2) -> disable cti2 cti_put(cti2)
cti_unmap_triggerout(cti1) -> decrement cti1 refcount cti_unmap_triggerin(cti1) -> disable cti1 cti_put(cti1)

With this, it is possible to push clock management inside enable and disable as opposed to get and put though it would imply enable being done before the actual mapping inside cti_map_triggerin/out and disable after unmapping in cti_unmap_triggerin/out. It might also mean cti_map_triggerin/out and cti_unmap_triggerin/out having a non-atomic context call semantics.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#30 lore raw
In reply to Will Deacon
Quoted 28 lines · Will Deacon

Hi Pratik,

Quoted 18 lines · pratikp at codeaurora.org

This RFC is aimed at introducing CoreSight framework as well as individual CoreSight trace component drivers adhering to ARM CoreSight specification. Some prior discussion on this can be referred at [1].

There are 3 kinds of CoreSight trace components:

* Sources: Responsible for producing trace data to provide visibility for the associated entity.

* Links: Transport components that carry trace data.

* Sinks: Collectors for storing trace data or acting as conduits for off-chip trace data collection.

These components can be connected in various topologies to suite a particular SoCs tracing needs.

Quoted 6 lines

Framework is responsible for gathering and using the information about the registered CoreSight components and their connections to allow it to dynamically deduce the sequence of components representing a connection from a CoreSight source to the currently selected CoreSight sink. This helps the framework to program the correct set of components to satisfy user request.

Quoted 6 lines

From a million miles up, this looks like a sensible sort of design but I really think you need to talk to Jon Hunter (he's at least on CC) about this, especially where bindings are concerned. If we can get something that you both agree on, then we can include the CTI with the other coresight components and do a more in-depth review at that point.

Thanks for the feedback.

Quoted 5 lines

Finally, how do you plan on exposing this data to the user? I think the only sane way is to have per-device file descriptors which act as pipes to the raw data but this means we need some readily available, open-source tooling (or at least public specifications of the trace formats).

The sink drivers (ETB, TMC), expose a device node per device that is used to collect the raw data.

Eg:, we have:
/dev/coresight-etb
/dev/coresight-tmc-etf
/dev/coresight-tmc-etr

where reading /dev/coresight-tmc-etf only works when the ETF is in circular buffer mode.

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#31 lore raw
In reply to pratikp at codeaurora.org

Would it be easy to add dummy sources to control data coming from other ETM sources not controlled by the kernel. Also I want the ability to have multiple sinks enabled at one time and just control the flow from the sources to direct where the data goes. Not that clear but I hope you understand :)

BR
Robert

Quoted 91 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-kernel-bounces at lists.infradead.org] On Behalf Of pratikp at codeaurora.org
Sent: den 18 december 2012 20:19
To: linux-arm-kernel at lists.infradead.org
Cc: linux at arm.linux.org.uk; linus.walleij at linaro.org; will.deacon at arm.com; Magnus PERSSON; david.rusling at linaro.org; arve at android.com; dsaxena at linaro.org; john.stultz at linaro.org; jon-hunter at ti.com; d-deao at ti.com; Christian BEJRAM; devicetree- discuss at lists.ozlabs.org
Subject: CoreSight framework and drivers

This RFC is aimed at introducing CoreSight framework as well as individual CoreSight trace component drivers adhering to ARM CoreSight specification. Some prior discussion on this can be referred at [1].

There are 3 kinds of CoreSight trace components:

* Sources: Responsible for producing trace data to provide visibility for the associated entity.

* Links: Transport components that carry trace data.

* Sinks: Collectors for storing trace data or acting as conduits for off-chip trace data collection.

These components can be connected in various topologies to suite a particular SoCs tracing needs.

Framework is responsible for gathering and using the information about the registered CoreSight components and their connections to allow it to dynamically deduce the sequence of components representing a connection from a CoreSight source to the currently selected CoreSight sink. This helps the framework to program the correct set of components to satisfy user request.

[1] http://comments.gmane.org/gmane.linux.ports.arm.kernel/204591

Pratik Patel (8):
coresight: add CoreSight core layer framework
coresight: add CoreSight TMC driver
coresight: add CoreSight TPIU driver
coresight: add CoreSight ETB driver
coresight: add CoreSight Funnel driver
coresight: add CoreSight Replicator driver
coresight: add CoreSight STM driver
coresight: add CoreSight ETM driver

 Documentation/devicetree/bindings/arm/coresight.txt |  110 ++
 arch/arm/include/asm/hardware/cp14.h                |  540 ++++++
 drivers/Kconfig                                     |    2 +
 drivers/Makefile                                    |    1 +
 drivers/coresight/Kconfig                           |   60 +
 drivers/coresight/Makefile                          |    8 +
 drivers/coresight/coresight-etb.c                   |  467 +++++
 drivers/coresight/coresight-etm-cp14.c              |  510 ++++++
 drivers/coresight/coresight-etm.c                   | 1752 +++++++++++++++++++
 drivers/coresight/coresight-funnel.c                |  260 +++
 drivers/coresight/coresight-priv.h                  |   48 +
 drivers/coresight/coresight-replicator.c            |  211 +++
 drivers/coresight/coresight-stm.c                   |  819 +++++++++
 drivers/coresight/coresight-tmc.c                   |  794 +++++++++
 drivers/coresight/coresight-tpiu.c                  |  232 +++
 drivers/coresight/coresight.c                       |  681 +++++++
 drivers/coresight/of_coresight.c                    |   99 ++
 include/linux/coresight-stm.h                       |   51 +
 include/linux/coresight.h                           |  167 ++
 include/linux/of_coresight.h                        |   27 +
 20 files changed, 6839 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/coresight.txt
 create mode 100644 arch/arm/include/asm/hardware/cp14.h
 create mode 100644 drivers/coresight/Kconfig
 create mode 100644 drivers/coresight/Makefile
 create mode 100644 drivers/coresight/coresight-etb.c
 create mode 100644 drivers/coresight/coresight-etm-cp14.c
 create mode 100644 drivers/coresight/coresight-etm.c
 create mode 100644 drivers/coresight/coresight-funnel.c
 create mode 100644 drivers/coresight/coresight-priv.h
 create mode 100644 drivers/coresight/coresight-replicator.c
 create mode 100644 drivers/coresight/coresight-stm.c
 create mode 100644 drivers/coresight/coresight-tmc.c
 create mode 100644 drivers/coresight/coresight-tpiu.c
 create mode 100644 drivers/coresight/coresight.c
 create mode 100644 drivers/coresight/of_coresight.c
 create mode 100644 include/linux/coresight-stm.h
 create mode 100644 include/linux/coresight.h
 create mode 100644 include/linux/of_coresight.h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel