From patchwork Wed Jun 20 22:47:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9516 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 6841A23E1B for ; Wed, 20 Jun 2012 22:48:10 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1C20CA18290 for ; Wed, 20 Jun 2012 22:48:10 +0000 (UTC) Received: by ghbz12 with SMTP id z12so1450ghb.11 for ; Wed, 20 Jun 2012 15:48:09 -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=KTbqizMNnn/5qsrwL/hVJf9/V8aUiwdoVFp+E+H6uLM=; b=emLcq+0DqWtcNgk5dFdPWkfwSwwkEzlL2V25MD4hKho6Tj672xedM/jtffaeC6Kjee 9ipmpCeUmjQj5Mlh/UjnW87sxOXfXxNXkbHEGmal79OcdQvya294gaHxDqL/izo4xe2c zVudmvt6DFN1sOjEhoZPcHe8Kjy0sSYJUKB97XnyG5q2+cos6VcjhMVLEhLXgoFMLuNr shdlOQk2aD7LRjeW5hYMXQniM3RMNhEvgSuykPpBk7YPLusQiS+2lGAb3AGKt0lsPN1l pIlIL1cgvvhzZxO/PpCcPddkjRLePCX6UdMXp+zLHLef2tGK5N8diJKa3h6NsmpSS5ww wVDw== Received: by 10.50.203.39 with SMTP id kn7mr5948931igc.53.1340232489253; Wed, 20 Jun 2012 15:48:09 -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 v20csp204142ibb; Wed, 20 Jun 2012 15:48:08 -0700 (PDT) Received: by 10.236.75.6 with SMTP id y6mr29692364yhd.24.1340232488362; Wed, 20 Jun 2012 15:48:08 -0700 (PDT) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com. [32.97.182.139]) by mx.google.com with ESMTPS id i10si971692yhm.74.2012.06.20.15.48.07 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 15:48:08 -0700 (PDT) Received-SPF: neutral (google.com: 32.97.182.139 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.139; Authentication-Results: mx.google.com; spf=neutral (google.com: 32.97.182.139 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 e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Jun 2012 18:48:07 -0400 Received: from d01dlp01.pok.ibm.com (9.56.224.56) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Jun 2012 18:48:04 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id E9F3E38C801C; Wed, 20 Jun 2012 18:48:03 -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 q5KMm3x9209416; Wed, 20 Jun 2012 18:48:03 -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 q5KMm2Bu029295; Wed, 20 Jun 2012 16:48:03 -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 q5KMls23028868; Wed, 20 Jun 2012 16:48:01 -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 07/15] ARM: etm: Return the entire trace buffer if it is empty after reset Date: Wed, 20 Jun 2012 18:47:39 -0400 Message-Id: <1340232467-6023-8-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-7182-0000-0000-000001CC3B88 X-Gm-Message-State: ALoCoQlDa7fhqAzRDngg5QsSa6ROoCiNhS7W1FIzWL7l65SAwEp4uvTKZXfTmfzLf3bcvDfX3bYP 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 Acked-by: Alexander Shishkin Signed-off-by: Arve Hjønnevåg Signed-off-by: John Stultz --- arch/arm/kernel/etm.c | 5 +++++ 1 file changed, 5 insertions(+) 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);