From patchwork Thu Dec 3 21:04:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 57676 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp166703lbb; Thu, 3 Dec 2015 13:06:47 -0800 (PST) X-Received: by 10.66.182.202 with SMTP id eg10mr16336694pac.50.1449176807514; Thu, 03 Dec 2015 13:06:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si14122328pfi.240.2015.12.03.13.06.47; Thu, 03 Dec 2015 13:06:47 -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.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754527AbbLCVGI (ORCPT + 28 others); Thu, 3 Dec 2015 16:06:08 -0500 Received: from mail-io0-f172.google.com ([209.85.223.172]:33318 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754498AbbLCVGB (ORCPT ); Thu, 3 Dec 2015 16:06:01 -0500 Received: by iouu10 with SMTP id u10so97015435iou.0 for ; Thu, 03 Dec 2015 13:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZBf/5k0Muusrmau2IBWGg7SqrlVNlfvLot9LZprMkCo=; b=wSugGWFAbfylG1H8oEE5O4ylP73uX4SnS0v1fQSk8DO0FZ1pQXcq8utl9bvaoWd7OI RoGyYHjEiVb2C9wro2O+ffuCCX/0oVanXsl8uNdw4aNPaaZhVUr62UOEYhE2Su8EPH/Z QUv9WVOrrQwE/LrqC7XHqfTBfk6+/95ExN1fFXo5zygvzgc1zPHSWaqOq7hDmlFaKEgN Qn1mKuWtqujj+ijUAPHGnAxRnCfI6DhPQ38Smvm31ljvVFMuCm962e/9mzNWyXyutsuf pma8nIMWJjB5qbVFcbPJHBW5KSQ62+IhKI/WisOD8O8ur/y8v3CGUywVs1VyHQ0rvbdT fRgA== 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=ZBf/5k0Muusrmau2IBWGg7SqrlVNlfvLot9LZprMkCo=; b=djgroK3dnO/Dd8PLUvs+TXNOKNlOuZXXR+CWd9pdBe9pVgGMS6aMw72sh0g2HdqExX NQftaDHXvjSqFf5M5PRBvXf3VdOMDR1RyDH0a1IWFuEKg1RRc5kKRK6WU8ldEUo/id7H pyfE5RLdijtSedk8Zsl6r9yWKYB3ZTAACk6EGWTgqR/9meZByJrxynII29rfFbtz691Z 8oyYRkP++qrfn3lWmOQCcTnojH/pIJvpjes8KU35a2pz3nA0hHv3FcaKRwuWsVIjq/ge ha3OsimX83vHnBneGjRgKEBNUaOauwBgbK2XpSaEXx3aYMje5WN4pk0Q5kLjChq3z64K 6u5g== X-Gm-Message-State: ALoCoQmn7AdPPEs3M4C/DXCL/ZhyU+8zJMuSv5pIhPYoqmKVFXRRD5uypsab1Ft1HZYYG/7xlB7w X-Received: by 10.107.14.137 with SMTP id 131mr10192937ioo.69.1449176760637; Thu, 03 Dec 2015 13:06:00 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [184.64.168.246]) by smtp.gmail.com with ESMTPSA id d81sm3615433ioj.12.2015.12.03.13.05.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Dec 2015 13:05:59 -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 V6 22/26] coresight: introducing a global trace ID function Date: Thu, 3 Dec 2015 14:04:58 -0700 Message-Id: <1449176702-13213-23-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449176702-13213-1-git-send-email-mathieu.poirier@linaro.org> References: <1449176702-13213-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 6170df1b9e59..02186b722d88 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 @@ -793,11 +794,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