From 8a57dac0160d0221e70c7073f62d15bf97a75ea5 Mon Sep 17 00:00:00 2001 From: Pratik Patel Date: Tue, 22 Jan 2013 18:23:57 -0800 Subject: [PATCH] coresight: hotplug enable/disable etm only for round robin access Enable and disable ETM during hotplug operations only if ETM is allowed round-robin access by the funnel when all the ETMs share the same funnel priority. For 8960, 8064, etc it is observed that sometimes a core's ETM is starved by other core ETMs constantly producing data. This works around an issue seen where setting the prog bit of a core's ETMCR (i.e. ETMCR[10]) doesn't result in that core's ETMSR[1] getting set thereby triggering the "timeout while setting prog bit" warning. Subsequently performaing a manual ETB flush as part of disabling ETB to retrieve the collected trace data also fails. Change-Id: I6dd37979058644495d945e80e6a2de4696fc5a20 Signed-off-by: Pratik Patel --- .../devicetree/bindings/coresight/coresight.txt | 3 +++ drivers/coresight/coresight-etm.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/coresight/coresight.txt b/Documentation/devicetree/bindings/coresight/coresight.txt index b3037d8ddad..96359726e2c 100644 --- a/Documentation/devicetree/bindings/coresight/coresight.txt +++ b/Documentation/devicetree/bindings/coresight/coresight.txt @@ -33,6 +33,8 @@ Optional properties: - coresight-default-sink : represents the default compile time CoreSight sink - qcom,pc-save : program counter save implemented - qcom,blk-size : block size for tmc-etr to usb transfers +- qcom,round-robin : indicates if per core etms are allowed round-robin access + by the funnel Examples: @@ -106,4 +108,5 @@ Examples: coresight-child-list = <&funnel_kpss>; coresight-child-ports = <0>; qcom,pc-save; + qcom,round-robin; }; diff --git a/drivers/coresight/coresight-etm.c b/drivers/coresight/coresight-etm.c index 01a71e9f40c..4d77e34182b 100644 --- a/drivers/coresight/coresight-etm.c +++ b/drivers/coresight/coresight-etm.c @@ -256,6 +256,7 @@ struct etm_drvdata { bool pcsave_enable; bool pcsave_sticky_enable; bool pcsave_boot_enable; + bool round_robin; }; static struct etm_drvdata *etmdrvdata[NR_CPUS]; @@ -1845,7 +1846,7 @@ static int etm_cpu_callback(struct notifier_block *nfb, unsigned long action, etmdrvdata[cpu]->os_unlock = true; } - if (etmdrvdata[cpu]->enable) + if (etmdrvdata[cpu]->enable && etmdrvdata[cpu]->round_robin) __etm_enable(etmdrvdata[cpu]); spin_unlock(&etmdrvdata[cpu]->spinlock); break; @@ -1858,7 +1859,7 @@ static int etm_cpu_callback(struct notifier_block *nfb, unsigned long action, case CPU_DYING: spin_lock(&etmdrvdata[cpu]->spinlock); - if (etmdrvdata[cpu]->enable) + if (etmdrvdata[cpu]->enable && etmdrvdata[cpu]->round_robin) __etm_disable(etmdrvdata[cpu]); spin_unlock(&etmdrvdata[cpu]->spinlock); break; @@ -2099,6 +2100,10 @@ static int __devinit etm_probe(struct platform_device *pdev) clk_disable_unprepare(drvdata->clk); + if (pdev->dev.of_node) + drvdata->round_robin = of_property_read_bool(pdev->dev.of_node, + "qcom,round-robin"); + baddr = devm_kzalloc(dev, PAGE_SIZE + reg_size, GFP_KERNEL); if (baddr) { *(uint32_t *)(baddr + ETM_REG_DUMP_VER_OFF) = ETM_REG_DUMP_VER;