From patchwork Mon Nov 23 18:33:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 57181 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1603140lbb; Mon, 23 Nov 2015 10:35:59 -0800 (PST) X-Received: by 10.68.57.169 with SMTP id j9mr37748992pbq.2.1448303759779; Mon, 23 Nov 2015 10:35:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az5si21664300pbc.86.2015.11.23.10.35.59; Mon, 23 Nov 2015 10:35:59 -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 S1755308AbbKWSf5 (ORCPT + 28 others); Mon, 23 Nov 2015 13:35:57 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:35765 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755145AbbKWSed (ORCPT ); Mon, 23 Nov 2015 13:34:33 -0500 Received: by pacej9 with SMTP id ej9so198776450pac.2 for ; Mon, 23 Nov 2015 10:34:33 -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=PDfpKSg78ziyvLY11kauEIm1YhL7Iwx231nHKJxPaBOsstCSBuZPMhHhmTO1hdIcit AppCQsqoo5lBsUbVM1Qdj96tCOFteFfbpxhQJVNFezINcQHGUmuoNqeltGcW3Nj/CObX AGookBr3cKJ6x3ImkE5Jctc5ZxE1xwgfJJEDbeN7j+xxFzSliYXfotUixRIGQvF7eBc+ oaAINBF0uSZ/wpXWGs+hmWswj6So+GqY2kSl8Ol3K700rVNZ9Bg9uA0RwoVrFRu9KQ99 DD60NZmr5gsB+OK7CmnsuzXBCo6Tsa91exktsbjPrQSsDrCJx97Z9FMPuX54phmKJpxq puaw== 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=F7W9tOsYaWAOZzBF8MxW+Hmbs+hmMloAKbN25aFHEdnaKla9NT+mbMx119T8QlfcUl MhuQ8HaPSCKitxqo1y/yV1W8T7h+6kNkIJdhn7qqrs9mH/mYb7EpPdW9alriQNOmADI4 hBjzcRrZpXXCdpQtmvrXsPRZ7T9LL321lR8whzPknVHz+sf4d2fvkidxZ6NBbUe60FyT cWVfv2vqVYsADB6BB1bX0a+PlTx9K3Bx3ogeSzAU1vM4ONA90PD+K6R6GbM+MZC3BG0H 5oRFUFubAReK9cUed4GftoFBNg9TmHAkMqwqSuZjZu3PgWnGuP//Lz2VngaBMFbOBNCx +tkg== X-Gm-Message-State: ALoCoQkYDkcfEQnRg7z9NsKdhCEG1rPIhMRxxGeh9l/IRm00e/LdavC4j1HhidITd1dPq4AtAbh8 X-Received: by 10.66.254.73 with SMTP id ag9mr37970281pad.116.1448303673018; Mon, 23 Nov 2015 10:34:33 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id r20sm10865186pfa.93.2015.11.23.10.34.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 10:34:32 -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: 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 Subject: [RESEND PATCH V4 21/26] coresight: introducing a global trace ID function Date: Mon, 23 Nov 2015 11:33:13 -0700 Message-Id: <1448303598-11249-22-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448303598-11249-1-git-send-email-mathieu.poirier@linaro.org> References: <1448303598-11249-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