From patchwork Wed Nov 11 22:18:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 56404 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp75677lbb; Wed, 11 Nov 2015 14:21:47 -0800 (PST) X-Received: by 10.66.254.73 with SMTP id ag9mr17987891pad.116.1447280507394; Wed, 11 Nov 2015 14:21:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dl5si15255433pbb.108.2015.11.11.14.21.47; Wed, 11 Nov 2015 14:21: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 S1753244AbbKKWVp (ORCPT + 28 others); Wed, 11 Nov 2015 17:21:45 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36121 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753054AbbKKWTy (ORCPT ); Wed, 11 Nov 2015 17:19:54 -0500 Received: by pacdm15 with SMTP id dm15so42817789pac.3 for ; Wed, 11 Nov 2015 14:19:53 -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=4RMqLpUru2kkefq6InOsLCqWDIZ7THDFh6NGyu84LDo=; b=NVImrXZvjSK9p+iqfaQeUhxE4Wh+xyvRqYIZDDWANAbPeDkIgZRGsRPuTs+WRcR5u6 SxBfP/kp90n3rwok+qe9Q9gS7SeD0N3VS4RQHhkYOhj6DUwU4M8no/gGOAZJQA/ev9/s zJYtjxjV7cLLBKpFq2xN62rMZoXMSs3LpuT0uMGarroVIP/IVLv3wzS56AHUhur2MPg+ JPxndQcyOk0aOrmP/7TjhEsfGBq61nqY/1NE827oGaDMDz5zfmuIv3AoNRULwAqy6Jqv V9aKlf+964mTDzrdxYigE8LjslTOuOh4csmkq7FlN02wOXEysko6U2jOA/zVrbXOx0HU 8UtQ== 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=4RMqLpUru2kkefq6InOsLCqWDIZ7THDFh6NGyu84LDo=; b=HvgcTRnxJWuu/+yTyJYbdJCcrtdnCyyZwSifC81cBkYGRIq7tAs8LeSGZU72COjd17 /mQxkexTNUuBJ1/n/E2NF5NZMrKMhGm6xhOIU9q27FtUcUfQomuHND9TnTw1InMOh9sQ EtfLlemnUArqathdE41ieYnn8qoWm+R2uUgKw6xYw3h1pO/rJwRkZHiwRz8qvncHeVtP UXYvId+QJq4W24m2O83xVjapS+FycZPOIO3uib/UdDjsXvgdeX47hBe1c0b7y3czzydJ C9V1RF30BhKXXKD29M8HoSdE5Wwg074u6sFTHpBmjIn0O8g/JlE7ViVVw9rqLzXexEqe 0DXg== X-Gm-Message-State: ALoCoQkL/Uby58EhOAApSgk63de1WI0bUy8JVOvvEMvQVJbtFy0isOhXQMUbtPyyaIh8aAUygHVu X-Received: by 10.68.200.103 with SMTP id jr7mr18088237pbc.77.1447280393741; Wed, 11 Nov 2015 14:19:53 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id h10sm11156697pat.7.2015.11.11.14.19.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Nov 2015 14:19:53 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, alexander.shishkin@linux.intel.com, acme@kernel.org, mingo@redhat.com, corbet@lwn.net, nicolas.pitre@linaro.org Cc: adrian.hunter@intel.com, 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@linaro.org Subject: [PATCH V3 21/26] coresight: introducing a global trace ID function Date: Wed, 11 Nov 2015 15:18:11 -0700 Message-Id: <1447280296-19147-22-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447280296-19147-1-git-send-email-mathieu.poirier@linaro.org> References: <1447280296-19147-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(-) -- 1.9.1 -- 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 c07b7d3eee86..ebd569986bd4 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 @@ -784,11 +785,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