From patchwork Wed Jun 13 02:01:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9250 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 96D0923E37 for ; Wed, 13 Jun 2012 02:01:55 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 51077A18221 for ; Wed, 13 Jun 2012 02:01:55 +0000 (UTC) Received: by yhpp61 with SMTP id p61so171906yhp.11 for ; Tue, 12 Jun 2012 19:01:54 -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=f4eNrAbJS7rf+cw9709G/cTIdjLOl7ZmQm4Y2ouW3bk=; b=oViixleWdx/EWez3L0e1PDeSo93B1uj6qSyoRvHv3Uxx1Evs3Z0TLnBM4BY+qsJNai KWnnltiaJq9kS3QEN+J4b5lEsUmgfhYQJuyQnCXCDeXNQuPD+mq5wzr+3uI9Vb/O8kAY NkJwi08xKikffmhlFgCCDkNCt4yOm9Ye22aWdQcTpTbfamV/kzT9nzC7PvF9FwlrvTT8 +6DYsy8O9kIso39u97KWS++1zr+eWwoA89zIjoiMVz/R1/CMx2Awv09oMSr366J+M2n8 ldVjLL6DuImLseHfI2O/LaG1zdf6BW3iRjWtiq0F+Zd+MfNl2ms3hZpKv2JXFo1R4cc9 gXVA== Received: by 10.50.160.198 with SMTP id xm6mr9745972igb.0.1339552914549; Tue, 12 Jun 2012 19:01:54 -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 v20csp200429ibb; Tue, 12 Jun 2012 19:01:54 -0700 (PDT) Received: by 10.68.193.195 with SMTP id hq3mr44741592pbc.30.1339552913848; Tue, 12 Jun 2012 19:01:53 -0700 (PDT) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com. [32.97.182.145]) by mx.google.com with ESMTPS id op2si4942741pbc.76.2012.06.12.19.01.53 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 19:01:53 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.145 as permitted sender) client-ip=32.97.182.145; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.145 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by e5.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Jun 2012 22:01:52 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e5.ny.us.ibm.com (192.168.1.105) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 12 Jun 2012 22:01:50 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 0DD4D6E804D; Tue, 12 Jun 2012 22:01:50 -0400 (EDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5D21mvN212638; Tue, 12 Jun 2012 22:01:48 -0400 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5D21l1h024641; Tue, 12 Jun 2012 20:01:48 -0600 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5D21gwB024319; Tue, 12 Jun 2012 20:01:43 -0600 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 1B0CEC0628; Tue, 12 Jun 2012 19:01:41 -0700 (PDT) From: John Stultz To: LKML Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Russell King , Paul Gortmaker , Alexander Shishkin , Mathieu Poirier , John Stultz Subject: [PATCH 07/15] ARM: etm: Return the entire trace buffer if it is empty after reset Date: Tue, 12 Jun 2012 19:01:25 -0700 Message-Id: <1339552887-17204-8-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1339552887-17204-1-git-send-email-john.stultz@linaro.org> References: <1339552887-17204-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061302-5930-0000-0000-000008CBAC96 X-Gm-Message-State: ALoCoQknCI7h1ixxreMF/3LwpTEoJDRchuKuIvuN1O4+1ddp86DofXE+DlP0lgm59AR9CEqbzGCh From: Arve Hjønnevåg On some SOCs the read and write pointer are reset when the chip resets, but the trace buffer content is preserved. If the status bits indicates that the buffer is empty and we have never started tracing, assume the buffer is full instead. This can be useful if the system rebooted from a watchdog reset. CC: Russell King CC: Paul Gortmaker CC: Alexander Shishkin CC: Mathieu Poirier Acked-by: Alexander Shishkin Signed-off-by: Arve Hjønnevåg Signed-off-by: John Stultz --- arch/arm/kernel/etm.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c index 3d21cf6..74444e5 100644 --- a/arch/arm/kernel/etm.c +++ b/arch/arm/kernel/etm.c @@ -45,6 +45,7 @@ struct tracectx { unsigned long range_end; unsigned long data_range_start; unsigned long data_range_end; + bool dump_initial_etb; struct device *dev; struct clk *emu_clk; struct mutex mutex; @@ -106,6 +107,7 @@ static int trace_start(struct tracectx *t) etb_unlock(t); + t->dump_initial_etb = false; etb_writel(t, 0, ETBR_WRITEADDR); etb_writel(t, 0, ETBR_FORMATTERCTRL); etb_writel(t, 1, ETBR_CTRL); @@ -312,6 +314,8 @@ static ssize_t etb_read(struct file *file, char __user *data, etb_unlock(t); total = etb_getdatalen(t); + if (total == 0 && t->dump_initial_etb) + total = t->etb_bufsz; if (total == t->etb_bufsz) first = etb_readl(t, ETBR_WRITEADDR); @@ -386,6 +390,7 @@ static int __devinit etb_probe(struct amba_device *dev, const struct amba_id *id goto out_release; } + t->dump_initial_etb = true; amba_set_drvdata(dev, t); etb_unlock(t);