From patchwork Fri Dec 18 20:59:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 58736 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1267718lbb; Fri, 18 Dec 2015 13:00:28 -0800 (PST) X-Received: by 10.66.153.198 with SMTP id vi6mr8332134pab.37.1450472427808; Fri, 18 Dec 2015 13:00:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si22100546pfa.163.2015.12.18.13.00.27; Fri, 18 Dec 2015 13:00:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965488AbbLRVAU (ORCPT + 29 others); Fri, 18 Dec 2015 16:00:20 -0500 Received: from mail-ig0-f176.google.com ([209.85.213.176]:34063 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965438AbbLRVAN (ORCPT ); Fri, 18 Dec 2015 16:00:13 -0500 Received: by mail-ig0-f176.google.com with SMTP id m11so418119igk.1 for ; Fri, 18 Dec 2015 13:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cbO8rBui6cFClP9b0W5SfVV1uvEYflzYqwmv9RMAJIU=; b=NLtMJyAmy2HskHNh1UbddIFhIQwzAD26wX6vfnQJv6LI9Vs48Squ2x8KKQT9A9Xxqz gePirdL5x/eq6WOkl4Lczj3gab5kZgkL8rvyrTJeM2wdCfQ/wUnaxdg6zBOCpAPXJgBx eGFJLY3O+MURF1Slj/1h6KJs87FhS8jWkCBTU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cbO8rBui6cFClP9b0W5SfVV1uvEYflzYqwmv9RMAJIU=; b=KV8TdGQl7D33ayTV6rO/yr1Zkmv0ga9kNGV9iym1MDGwqrb271gge2hij2YSnMzePx 9qBVlHhOHVCjPAnsapbJZHbJCncLOs5zwYZtkOJFU+W8q/CfnDWmVD0U2Q6PT4Fsq1XG WWSCjMVArC9fI5m4RCMQtjgTScKBQhdp38X3ZTsy+H3SEgi3JsG7vwDWywdAe4WVgT4N TE91cMz2GQfmsGFtvbZ5SddLXYPWw0N+U4kI9p6F8dzLmLdtzEg7wSjQvCKnkwbgcggM hGaw0HNe+Ytrqz8mB12bg8RdCxq3uzKzfWSR/2nc5OsSoTjDfEB/zVYdSFtTyOOe/jTT TC3A== X-Gm-Message-State: ALoCoQmcZhe1T77y+BJfoyAzEWqKWT9X3NSbv1VwNU75QrEQWD7DNHklWcddoaXcKWwzdoLg1i5z0KV7nlgTz565jqhIp6+eCQ== X-Received: by 10.50.171.202 with SMTP id aw10mr5553793igc.26.1450472413218; Fri, 18 Dec 2015 13:00:13 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id l10sm843701igx.18.2015.12.18.13.00.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 13:00:12 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, alexander.shishkin@linux.intel.com Cc: zhang.chunyan@linaro.org, mike.leach@arm.com, tor@ti.com, al.grant@arm.com, fainelli@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mathieu Poirier Subject: [PATCH V7 20/24] coresight: introducing a global trace ID function Date: Fri, 18 Dec 2015 13:59:16 -0700 Message-Id: <1450472361-426-21-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450472361-426-1-git-send-email-mathieu.poirier@linaro.org> References: <1450472361-426-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org TraceID values have to be unique for all tracers and consistent between drivers and user space. As such introducing a central function to be used whenever a traceID value is required. The patch also account for data traceIDs, which are usually I(N) + 1. Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 7 ++----- include/linux/coresight-pmu.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 26310db643f7..471b9579cea8 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -742,11 +743,7 @@ static void etm_init_arch_data(void *info) static void etm_init_trace_id(struct etm_drvdata *drvdata) { - /* - * A trace ID of value 0 is invalid, so let's start at some - * random value that fits in 7 bits and go from there. - */ - drvdata->traceid = 0x10 + drvdata->cpu; + drvdata->traceid = coresight_get_trace_id(drvdata->cpu); } static int etm_probe(struct amba_device *adev, const struct amba_id *id) diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h index 6c5386b23b10..7d410260661b 100644 --- a/include/linux/coresight-pmu.h +++ b/include/linux/coresight-pmu.h @@ -19,9 +19,21 @@ #define _LINUX_CORESIGHT_PMU_H #define CORESIGHT_ETM_PMU_NAME "cs_etm" +#define CORESIGHT_ETM_PMU_SEED 0x10 /* ETMv3.5/PTM's ETMCR config bit */ #define ETM_OPT_CYCACC 12 #define ETM_OPT_TS 28 +static inline int coresight_get_trace_id(int cpu) +{ + /* + * A trace ID of value 0 is invalid, so let's start at some + * random value that fits in 7 bits and go from there. Since + * the common convention is to have data trace IDs be I(N) + 1, + * set instruction trace IDs as a function of the CPU number. + */ + return (CORESIGHT_ETM_PMU_SEED + (cpu * 2)); +} + #endif