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: 7720561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9319EBEEE1 for ; Mon, 30 Nov 2015 02:29:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C575B20481 for ; Mon, 30 Nov 2015 02:29:53 +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 71FED205F0 for ; Mon, 30 Nov 2015 02:29:52 +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 1a3ECS-0000y2-1n; Mon, 30 Nov 2015 02:28:20 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3E2a-000665-BN for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2015 02:18:15 +0000 Received: by padhx2 with SMTP id hx2so168045175pad.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=GN3fcj12Uet839PplhH36+QOorvpktsnZNFJ68qYGsUAPH3w2Hk6v9pE+nDaaiskRt c4MkHfUP6TqV0NHpDgMhkd2iEiwcOUrA2a+4ijfZMTsTmC4HyNlbGFvM98cAk/zfvvph pQHCnORehgN/b/LUeZrOOdDR04adfu6p680IVNWBjso+jVgateRT35WK7d0JBhCoQ1tb bYVv63RpDHP+4q9lDH111VJo/Lq70gDVGtXLysH1ZpX+vZWKrXz9kCOCb2l8A1YtJsNF vkKemKLWszkf6SpVsaU/GdQJg2N/rflO2de+zxJi9XjBcDxAJvzLzEqX6OFjAjQBml+W cCVw== X-Gm-Message-State: ALoCoQll8d17bPbewHvdk3zx66m+ubeClexgKNH3/HIHqmi5QsrljFznJKrUUiznBi/L33KYZfrw 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151129_181808_780293_8472F536 X-CRM114-Status: GOOD ( 14.06 ) 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, Mathieu Poirier , 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 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