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: 7685191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B159B9F1BE for ; Mon, 23 Nov 2015 18:41:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2B26207FE for ; Mon, 23 Nov 2015 18:41:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9D2B207F8 for ; Mon, 23 Nov 2015 18:41:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0w1q-0005dO-9v; Mon, 23 Nov 2015 18:39:54 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0vwz-0000Ic-FB for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2015 18:34:56 +0000 Received: by pacdm15 with SMTP id dm15so198930547pac.3 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=GZOAyktaFsBw0aOUzVaf6BprKJDMgEy+hrM7AsDmzAhnqKcl0zgkzwsc/sxTRqqLRH xvOTggvpGETDnCLVqodHG/gNlyxsCATDU8tyRcO/uwUhBSfgsBy4c36isrC6Z/eJ97hD L0veLsamPBGk17DaAgGFNTH9oJHit5TgPN+puW4kedDhhbC6qeu0NaCgxLrK6yYdRDXs 3YGAdzu4aH8Eu1lO6qI1sJ/6z8B7KVv8hDsId9vTQG7DWSXJr4L5EjnPbSME/iy5jEZr /1e8TYJ4DJECbeZki+Q8VxQW4cvAdyeujr7GWVVL/yIJ8Z9g52MaYw/jzTy6xNaLjr9j v7Cw== X-Gm-Message-State: ALoCoQkoFVGkExqOzh1SEI1n6YLX3VGsw01pwL2mJpesIkbijG56htXFg3zxia4n7pRFHxOHOKVz 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151123_103453_819959_5CDD63EB X-CRM114-Status: GOOD ( 14.28 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: al.grant@arm.com, pawel.moll@arm.com, linux-doc@vger.kernel.org, fainelli@broadcom.com, linux-kernel@vger.kernel.org, tor@ti.com, mike.leach@arm.com, zhang.chunyan@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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