From patchwork Mon Jan 2 22:55:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 9494233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 631CC606A6 for ; Mon, 2 Jan 2017 22:57:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 535E8266F3 for ; Mon, 2 Jan 2017 22:57:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 457972684F; Mon, 2 Jan 2017 22:57:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id F41CE266F3 for ; Mon, 2 Jan 2017 22:57:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOBWP-0004hA-7T; Mon, 02 Jan 2017 22:56:05 +0000 Received: from mail-wj0-x233.google.com ([2a00:1450:400c:c01::233]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOBWK-0004f6-G9 for linux-arm-kernel@lists.infradead.org; Mon, 02 Jan 2017 22:56:01 +0000 Received: by mail-wj0-x233.google.com with SMTP id sd9so248142675wjb.1 for ; Mon, 02 Jan 2017 14:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=eH9dlakOBYk7qhLzrIIDzc6Qnk9nboW36JC++d5px+E=; b=TOBNp2lOwJhTO9+0VY+B8WpwLDh2e446DikjqKlD1adfD0tmtq0k0+UtajmPQ9IL8/ NJpT+q/xZs4ziiuKzloTaa9CKk2lqDnz+LI+VmP1OUADFd+88+L5rmrPT91g547IiTUQ Y2yxhKXZU3LWMbm+PIPRay+46QepvQ+Men9NE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eH9dlakOBYk7qhLzrIIDzc6Qnk9nboW36JC++d5px+E=; b=F2iyMvL65RLw4JvLZD8AKqs4aqlmBCYl+MykXnlK0jkbFsWRRdRUW7JmwL8kSR81jZ 8VSNwFR5gXh65//SqQa2tySab8FsyCYb9PkEBgaWbcmXcCLHksWjeeVFrqjrG0PXjDzx lwamc6TK5ihy6uCJpE1WnlURfOLtTzkT7JBQGfGkktQi97p6Hitco3oK06fLbvr48bJb 5ZEdq6HJmZONa9kEYzQiV3gx7+nc+ggoyQuMsUvowquJR8jsx1IvX1vKDhVX5HEizsUU 3H5BDSncgHnx8lxnraIBGyRNubZYRaruABtMkUxZ+dDKQ6nuJu7pJwk831LGcfH8SKAv 0n+w== X-Gm-Message-State: AIkVDXL8M4QNBuOXAM3Xfm5SV8nj4F3UWuAtgjrrUpbRC03yewAYJxyR68cq62aYdlL0kL7t X-Received: by 10.194.188.40 with SMTP id fx8mr51971175wjc.128.1483397737963; Mon, 02 Jan 2017 14:55:37 -0800 (PST) Received: from linaro.org (cpc80201-blbn11-2-0-cust167.10-1.cable.virginm.net. [86.6.126.168]) by smtp.gmail.com with ESMTPSA id l67sm86306553wmf.20.2017.01.02.14.55.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jan 2017 14:55:37 -0800 (PST) From: Mike Leach To: mathieu.poirier@linaro.org Subject: [PATCH] coresight: etm4x: Fix enabling of cycle accurate tracing in perf. Date: Mon, 2 Jan 2017 22:55:19 +0000 Message-Id: <1483397719-22235-1-git-send-email-mike.leach@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170102_145600_903288_8818582C X-CRM114-Status: GOOD ( 11.96 ) 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: coresignt@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Mike Leach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Using perf record 'cyclacc' option in cs_etm event was not setting up cycle accurate trace correctly. Corrects bit set in TRCCONFIGR to enable cycle accurate trace. Programs TRCCCCTLR with a valid threshold value as required by ETMv4 spec. Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-etm4x.c | 7 +++++-- drivers/hwtracing/coresight/coresight-etm4x.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 4db8d6a..07be032 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -216,8 +216,11 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata, goto out; /* Go from generic option to ETMv4 specifics */ - if (attr->config & BIT(ETM_OPT_CYCACC)) - config->cfg |= ETMv4_MODE_CYCACC; + if (attr->config & BIT(ETM_OPT_CYCACC)) { + config->cfg |= BIT(4); + /* TRM: Must program this for cycacc to work */ + config->ccctlr = ETM_CYC_THRESHOLD_DEFAULT; + } if (attr->config & BIT(ETM_OPT_TS)) config->cfg |= ETMv4_MODE_TIMESTAMP; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index ba8d3f8..8a62c6c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -146,6 +146,7 @@ #define ETM_ARCH_V4 0x40 #define ETMv4_SYNC_MASK 0x1F #define ETM_CYC_THRESHOLD_MASK 0xFFF +#define ETM_CYC_THRESHOLD_DEFAULT 256 #define ETMv4_EVENT_MASK 0xFF #define ETM_CNTR_MAX_VAL 0xFFFF #define ETM_TRACEID_MASK 0x3f