From patchwork Wed Jun 20 22:47:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9525 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 90DF723E1B for ; Wed, 20 Jun 2012 22:48:53 +0000 (UTC) Received: from mail-yw0-f47.google.com (mail-yw0-f47.google.com [209.85.213.47]) by fiordland.canonical.com (Postfix) with ESMTP id 44220A18372 for ; Wed, 20 Jun 2012 22:48:53 +0000 (UTC) Received: by yhjj56 with SMTP id j56so1512yhj.20 for ; Wed, 20 Jun 2012 15:48:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding :x-content-scanned:x-cbid:x-gm-message-state; bh=0+U/IKc/jQNMriueG4KHRxwsvJQW70bhCBx4zVxQHxg=; b=g3at55eGoSM3D1HBptzugs6TT2rSarDbAQLzo4XTNirYdfqnJ3Ec1MmD5JRVnuM4KT dQkGI6DY4aPFdBIM36X6jDI9mgS/IUGF3aB33ASyJ7ZsoehTBCRjaL5cfA4I9iu8WYV/ maVxt/cbVn3Drro5Na8L9/w75CBbVapZ4SeiGbHQ7sU5MGmhoWlJO9R35YvctcDXNI96 s/lmNpYmbCyJEEDgm7BQE4yp6GzD8mJvIgZZpM6Jg67GLhw8U4goYhjA/WGe4FXgOQDk VFBNTTLeCZs2mBz0Rr+bda3F87oyyfURvUXqVQd8aSrqYNxJzzvmz8EYLjUAP52ZJCEP TyZQ== Received: by 10.42.89.72 with SMTP id f8mr11973612icm.33.1340232532515; Wed, 20 Jun 2012 15:48:52 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp204183ibb; Wed, 20 Jun 2012 15:48:52 -0700 (PDT) Received: by 10.236.46.74 with SMTP id q50mr30192948yhb.30.1340232531878; Wed, 20 Jun 2012 15:48:51 -0700 (PDT) Received: from e8.ny.us.ibm.com (e8.ny.us.ibm.com. [32.97.182.138]) by mx.google.com with ESMTPS id h13si430427anm.99.2012.06.20.15.48.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 15:48:51 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.138 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.138; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.138 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Jun 2012 18:48:51 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Jun 2012 18:48:07 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id E86FA6E804C; Wed, 20 Jun 2012 18:48:06 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5KMm6xu188822; Wed, 20 Jun 2012 18:48:06 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5KMm5Rv029492; Wed, 20 Jun 2012 16:48:06 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5KMls27028868; Wed, 20 Jun 2012 16:48:05 -0600 From: John Stultz To: LKML Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Russell King , Paul Gortmaker , Alexander Shishkin , John Stultz Subject: [PATCH 11/15] ARM: etm: Check arch version and disable data tracing for ptm Date: Wed, 20 Jun 2012 18:47:43 -0400 Message-Id: <1340232467-6023-12-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340232467-6023-1-git-send-email-john.stultz@linaro.org> References: <1340232467-6023-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062022-9360-0000-0000-000007914DA5 X-Gm-Message-State: ALoCoQn7MsqgBCg+j495GqeHiuV2t+I5Uozy8KosT0Ot7C91nEZGfi5spQUPFbJ7vUYMwNqcNDdC From: Arve Hjønnevåg Check arch version and disable data tracing for ptm CC: Russell King CC: Paul Gortmaker CC: Alexander Shishkin Acked-by: Alexander Shishkin Signed-off-by: Arve Hjønnevåg Signed-off-by: John Stultz --- arch/arm/include/asm/hardware/coresight.h | 5 +++++ arch/arm/kernel/etm.c | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/hardware/coresight.h b/arch/arm/include/asm/hardware/coresight.h index 6643d6c..0fad8f8 100644 --- a/arch/arm/include/asm/hardware/coresight.h +++ b/arch/arm/include/asm/hardware/coresight.h @@ -60,6 +60,7 @@ /* ETM configuration code register */ #define ETMR_CONFCODE (0x04) +#define ETMCCR_ETMIDR_PRESENT BIT(31) /* ETM trace start/stop resource control register */ #define ETMR_TRACESSCTRL (0x18) @@ -126,6 +127,10 @@ ETMCTRL_BRANCH_OUTPUT | \ ETMCTRL_DO_CONTEXTID) +#define ETMR_ID 0x1e4 +#define ETMIDR_VERSION(x) (((x) >> 4) & 0xff) +#define ETMIDR_VERSION_PFT_1_0 0x30 + #define ETMR_TRACEIDR 0x200 /* ETM management registers, "ETM Architecture", 3.5.24 */ diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c index bad28de..e42b706 100644 --- a/arch/arm/kernel/etm.c +++ b/arch/arm/kernel/etm.c @@ -724,6 +724,9 @@ static int __devinit etm_probe(struct amba_device *dev, const struct amba_id *id int ret = 0; void __iomem **new_regs; int new_count; + u32 etmccr; + u32 etmidr; + u8 etm_version = 0; mutex_lock(&t->mutex); new_count = t->etm_regs_count + 1; @@ -758,7 +761,12 @@ static int __devinit etm_probe(struct amba_device *dev, const struct amba_id *id /* dummy first read */ (void)etm_readl(&tracer, t->etm_regs_count, ETMMR_OSSRR); - t->ncmppairs = etm_readl(t, t->etm_regs_count, ETMR_CONFCODE) & 0xf; + etmccr = etm_readl(t, t->etm_regs_count, ETMR_CONFCODE); + t->ncmppairs = etmccr & 0xf; + if (etmccr & ETMCCR_ETMIDR_PRESENT) { + etmidr = etm_readl(t, t->etm_regs_count, ETMR_ID); + etm_version = ETMIDR_VERSION(etmidr); + } etm_writel(t, t->etm_regs_count, 0x441, ETMR_CTRL); etm_writel(t, t->etm_regs_count, new_count, ETMR_TRACEIDR); etm_lock(t, t->etm_regs_count); @@ -781,10 +789,15 @@ static int __devinit etm_probe(struct amba_device *dev, const struct amba_id *id if (ret) dev_dbg(&dev->dev, "Failed to create trace_range in sysfs\n"); - ret = sysfs_create_file(&dev->dev.kobj, &trace_data_range_attr.attr); - if (ret) - dev_dbg(&dev->dev, - "Failed to create trace_data_range in sysfs\n"); + if (etm_version < ETMIDR_VERSION_PFT_1_0) { + ret = sysfs_create_file(&dev->dev.kobj, + &trace_data_range_attr.attr); + if (ret) + dev_dbg(&dev->dev, + "Failed to create trace_data_range in sysfs\n"); + } else { + tracer.flags &= ~TRACER_TRACE_DATA; + } dev_dbg(&dev->dev, "ETM AMBA driver initialized.\n");