From patchwork Mon Nov 30 02:14:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 57412 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1179817lbb; Sun, 29 Nov 2015 18:18:01 -0800 (PST) X-Received: by 10.98.16.219 with SMTP id 88mr67266177pfq.154.1448849881129; Sun, 29 Nov 2015 18:18:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u82si25568735pfa.180.2015.11.29.18.18.00; Sun, 29 Nov 2015 18:18:01 -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 S1753425AbbK3CRz (ORCPT + 28 others); Sun, 29 Nov 2015 21:17:55 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34118 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751840AbbK3CRr (ORCPT ); Sun, 29 Nov 2015 21:17:47 -0500 Received: by padhx2 with SMTP id hx2so168045176pad.1 for ; Sun, 29 Nov 2015 18:17:47 -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=UskC2tQC3Yigd12dC4L9CGe55FqvGeH2KekQCO2ovoyz8cRuDSeIi7RrU0ctjg2POx gaGDbcrut0CiHWguCKm2tjp5ayz6axw+Bjz/qT0WR1TG63ZWUeHnumCu5IW0yYPHTOMW 8sa56UnMPdfwiGTkPz54NjrsbxHuWmB61fPJASY8R2vkgAhCTdURhcVlEqeABuMUxfdk 7/FqivEQaheIFJO4Wh8oyzv18UBvqgWZy76WGwRFnkZoa+gZ7E16uRhMFH/6KNyp1n1k ODkM0EaxcSJKr1s8fCmemAzwzOE9p2Rc4HxNHgYqK+sCdfKLbHHqqLjNy/q11f1MzuoE UeGQ== 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=fSIl0/hNJeyzAoDZqZDQzQh+k3bYeysHduIH81kNNoEIWSfinitq3164+08m1vxIef CK3gbx0AwuqEpFQL7e/756XG4Ld9Yq/8RzeabQi+AIpkok7x7lXUkXlM7JxzbVrDVfLW CPaiWiBPeoKMiOM6GZcCnOAK8UdwkQm+WNR4CCXbOqB++Ad/s60424fMnaFxmA4q5fYY pJM79+PSO8wwxhE/XYaZ/Y3Taka/b1y82cFx5Ysy4ikmTWO0LAE+si5tqQkKpsD/QygX UtKjJp5/aW7Asf5Sz5EoA7oaDjvtZygWD/KURe5lRGxQAx4H5KMpW09RdP41icCnYQFF udHA== X-Gm-Message-State: ALoCoQnQbpcgBxrj/ddDyjEVr4mjh1eI0cLtW45Dcwh0hlClm3w9L5q2MZRm2hD+zT5LENAEwBmr X-Received: by 10.98.14.129 with SMTP id 1mr67177843pfo.161.1448849867452; Sun, 29 Nov 2015 18:17:47 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id n16sm47168818pfa.53.2015.11.29.18.17.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Nov 2015 18:17:46 -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, pawel.moll@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 V5 22/26] coresight: introducing a global trace ID function Date: Sun, 29 Nov 2015 19:14:43 -0700 Message-Id: <1448849687-5724-23-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448849687-5724-1-git-send-email-mathieu.poirier@linaro.org> References: <1448849687-5724-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