All of lore.kernel.org
 help / color / mirror / Atom feed
From: daniel.thompson@linaro.org (Daniel Thompson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 07/11] coresight: add CoreSight ETM driver
Date: Tue, 03 Jun 2014 18:04:47 +0100	[thread overview]
Message-ID: <538E002F.1070907@linaro.org> (raw)
In-Reply-To: <CANLsYkwWWcrQPXWHZM=B7GBDQ4SyiB9cchaXPQFzvOKQUVSMTA@mail.gmail.com>

On 03/06/14 17:37, Mathieu Poirier wrote:
>>> +static ssize_t debugfs_status_read(struct file *file, char __user *user_buf,
>>> +                                size_t count, loff_t *ppos)
>>> +{
>>> +     ssize_t ret;
>>> +     uint32_t val;
>>> +     unsigned long flags;
>>> +     char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
>>> +     struct etm_drvdata *drvdata = file->private_data;
>>> +
>>> +     if (!buf)
>>> +             return -ENOMEM;
>>> +
>>> +     ret = clk_prepare_enable(drvdata->clk);
>>> +     if (ret)
>>> +             goto out;
>>> +
>>> +     spin_lock_irqsave(&drvdata->spinlock, flags);
>>> +
>>> +     ETM_UNLOCK(drvdata);
>>> +     val = etm_readl(drvdata, ETMCCR);
>>> +     ret += sprintf(buf, "ETMCCR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMCCER);
>>> +     ret += sprintf(buf + ret, "ETMCCER: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMSCR);
>>> +     ret += sprintf(buf + ret, "ETMSCR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMIDR);
>>> +     ret += sprintf(buf + ret, "ETMIDR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMCR);
>>> +     ret += sprintf(buf + ret, "ETMCR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMTEEVR);
>>> +     ret += sprintf(buf + ret, "Enable event: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMTSSCR);
>>> +     ret += sprintf(buf + ret, "Enable start/stop: 0x%08x\n", val);
>>> +     ret += sprintf(buf + ret,
>>> +                    "Enable control: CR1 0x%08x CR2 0x%08x\n",
>>> +                    etm_readl(drvdata, ETMTECR1),
>>> +                    etm_readl(drvdata, ETMTECR2));
>>> +
>>> +     ETM_LOCK(drvdata);
>>> +
>>> +     spin_unlock_irqrestore(&drvdata->spinlock, flags);
>>> +     clk_disable_unprepare(drvdata->clk);
>>> +
>>> +     ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
>>> +out:
>>> +     kfree(buf);
>>> +     return ret;
>>> +}
>>
>> Really not sure whether this should be in the read method. If we don't
>> read the file in one go the spin_lock() we'll not get a cohesive set of
>> registers.
> 
> I get your point but since there is a possibility (even very remove)
> that any of these registers can be changed between the two read
> operations, the only reasonable solution I see is to return an error
> if  (ret > size).  What your opinion on that?

I'd prefer that we simply copy the approach used by simple_attr_read().


Daniel.

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Thompson <daniel.thompson@linaro.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Will Deacon" <will.deacon@arm.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"John Stultz" <john.stultz@linaro.org>,
	"Pratik Patel" <pratikp@codeaurora.org>,
	"Vikas Varshney" <varshney@ti.com>, "Al Grant" <Al.Grant@arm.com>,
	"Jonas Svennebring" <jonas.svennebring@avagotech.com>,
	"James King" <james.king@linaro.org>,
	"Panchaxari Prasannamurthy Tumkur"
	<panchaxari.prasannamurthy@linaro.org>,
	"Arnd Bergmann" <arnd@linaro.org>,
	"Marcin Jabrzyk" <marcin.jabrzyk@gmail.com>,
	r.sengupta@samsung.com,
	"Robert Marklund" <robbelibobban@gmail.com>,
	"Patch Tracking" <patches@linaro.org>,
	"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 07/11] coresight: add CoreSight ETM driver
Date: Tue, 03 Jun 2014 18:04:47 +0100	[thread overview]
Message-ID: <538E002F.1070907@linaro.org> (raw)
In-Reply-To: <CANLsYkwWWcrQPXWHZM=B7GBDQ4SyiB9cchaXPQFzvOKQUVSMTA@mail.gmail.com>

On 03/06/14 17:37, Mathieu Poirier wrote:
>>> +static ssize_t debugfs_status_read(struct file *file, char __user *user_buf,
>>> +                                size_t count, loff_t *ppos)
>>> +{
>>> +     ssize_t ret;
>>> +     uint32_t val;
>>> +     unsigned long flags;
>>> +     char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
>>> +     struct etm_drvdata *drvdata = file->private_data;
>>> +
>>> +     if (!buf)
>>> +             return -ENOMEM;
>>> +
>>> +     ret = clk_prepare_enable(drvdata->clk);
>>> +     if (ret)
>>> +             goto out;
>>> +
>>> +     spin_lock_irqsave(&drvdata->spinlock, flags);
>>> +
>>> +     ETM_UNLOCK(drvdata);
>>> +     val = etm_readl(drvdata, ETMCCR);
>>> +     ret += sprintf(buf, "ETMCCR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMCCER);
>>> +     ret += sprintf(buf + ret, "ETMCCER: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMSCR);
>>> +     ret += sprintf(buf + ret, "ETMSCR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMIDR);
>>> +     ret += sprintf(buf + ret, "ETMIDR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMCR);
>>> +     ret += sprintf(buf + ret, "ETMCR: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMTEEVR);
>>> +     ret += sprintf(buf + ret, "Enable event: 0x%08x\n", val);
>>> +     val = etm_readl(drvdata, ETMTSSCR);
>>> +     ret += sprintf(buf + ret, "Enable start/stop: 0x%08x\n", val);
>>> +     ret += sprintf(buf + ret,
>>> +                    "Enable control: CR1 0x%08x CR2 0x%08x\n",
>>> +                    etm_readl(drvdata, ETMTECR1),
>>> +                    etm_readl(drvdata, ETMTECR2));
>>> +
>>> +     ETM_LOCK(drvdata);
>>> +
>>> +     spin_unlock_irqrestore(&drvdata->spinlock, flags);
>>> +     clk_disable_unprepare(drvdata->clk);
>>> +
>>> +     ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
>>> +out:
>>> +     kfree(buf);
>>> +     return ret;
>>> +}
>>
>> Really not sure whether this should be in the read method. If we don't
>> read the file in one go the spin_lock() we'll not get a cohesive set of
>> registers.
> 
> I get your point but since there is a possibility (even very remove)
> that any of these registers can be changed between the two read
> operations, the only reasonable solution I see is to return an error
> if  (ret > size).  What your opinion on that?

I'd prefer that we simply copy the approach used by simple_attr_read().


Daniel.

  reply	other threads:[~2014-06-03 17:04 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 13:43 [RFC PATCH 00/11] CoreSight framework and drivers mathieu.poirier at linaro.org
2014-05-30 13:43 ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 01/11] coresight: add CoreSight core layer framework mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 17:25   ` Rob Herring
2014-05-30 17:25     ` Rob Herring
2014-05-30 18:02     ` Mathieu Poirier
2014-05-30 18:02       ` Mathieu Poirier
2014-05-30 13:43 ` [RFC PATCH 02/11] coresight: add CoreSight TMC driver mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-06-03  9:09   ` Linus Walleij
2014-06-03  9:09     ` Linus Walleij
2014-06-16 23:12     ` Mathieu Poirier
2014-06-16 23:12       ` Mathieu Poirier
2014-07-07 10:53       ` Linus Walleij
2014-07-07 10:53         ` Linus Walleij
2014-05-30 13:43 ` [RFC PATCH 03/11] coresight: add CoreSight TPIU driver mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 04/11] coresight: add CoreSight ETB driver mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:53   ` Russell King - ARM Linux
2014-05-30 13:53     ` Russell King - ARM Linux
2014-05-30 16:28     ` Mathieu Poirier
2014-05-30 16:28       ` Mathieu Poirier
2014-05-30 13:43 ` [RFC PATCH 05/11] coresight: add CoreSight Funnel driver mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 06/11] coresight: add CoreSight Replicator driver mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 07/11] coresight: add CoreSight ETM driver mathieu.poirier
2014-06-03 10:26   ` Daniel Thompson
2014-06-03 10:26     ` Daniel Thompson
2014-06-03 16:37     ` Mathieu Poirier
2014-06-03 16:37       ` Mathieu Poirier
2014-06-03 17:04       ` Daniel Thompson [this message]
2014-06-03 17:04         ` Daniel Thompson
2014-05-30 13:43 ` [RFC PATCH 08/11] coresight: adding support for beagle board mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 09/11] coresight: adding basic support for Vexpress TC2 mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 10/11] coresight: adding support for beagleXM mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:43 ` [RFC PATCH 11/11] ARM: moving support for etb/etm to the "drivers" directory mathieu.poirier at linaro.org
2014-05-30 13:43   ` mathieu.poirier
2014-05-30 13:49   ` Russell King - ARM Linux
2014-05-30 13:49     ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538E002F.1070907@linaro.org \
    --to=daniel.thompson@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.