LKML Archive mirror
 help / color / mirror / Atom feed
From: "Jon Medhurst (Tixy)" <tixy@linaro.org>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 1/4] mailbox: add support for System Control and Power Interface(SCPI) protocol
Date: Thu, 30 Apr 2015 09:49:41 +0100	[thread overview]
Message-ID: <1430383781.2868.9.camel@linaro.org> (raw)
In-Reply-To: <1430310338.27241.45.camel@linaro.org>

On Wed, 2015-04-29 at 13:25 +0100, Jon Medhurst (Tixy) wrote:
> diff --git a/drivers/mailbox/scpi_protocol.c
> b/drivers/mailbox/scpi_protocol.c
> index c74575b..5818d9b 100644
> --- a/drivers/mailbox/scpi_protocol.c
> +++ b/drivers/mailbox/scpi_protocol.c
> @@ -286,14 +286,23 @@ static void scpi_tx_prepare(struct mbox_client
> *c, void *msg)
>         struct scpi_chan *ch = container_of(c, struct scpi_chan, cl);
>         struct scpi_shared_mem *mem = (struct scpi_shared_mem
> *)ch->tx_payload;
>  
> -       mem->command = cpu_to_le32(t->cmd);
>         if (t->tx_buf)
>                 memcpy_toio(mem->payload, t->tx_buf, t->tx_len);
>         if (t->rx_buf) {
> +               int token;
>                 spin_lock_irqsave(&ch->rx_lock, flags);
> +               /*
> +                * Presumably we can do this token setting outside
> +                * spinlock and still be safe from concurrency?
> +                */

To answer my own question, yes, the four lines below can be moved up
above the spin_lock_irqsave. Because we had better be safe from
concurrency here as we are also writing to the channel's shared memory
area.

> +               do
> +                       token = (++ch->token) & CMD_TOKEN_ID_MASK;
> +               while(!token);
> +               t->cmd |= token << CMD_TOKEN_ID_SHIFT;
>                 list_add_tail(&t->node, &ch->rx_pending);
>                 spin_unlock_irqrestore(&ch->rx_lock, flags);
>         }
> +       mem->command = cpu_to_le32(t->cmd);
>  }
>  
>  static struct scpi_xfer *get_scpi_xfer(struct scpi_chan *ch)

-- 
Tixy


  parent reply	other threads:[~2015-04-30  8:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 11:40 [PATCH 0/4] ARM64: add SCPI mailbox protocol, clock and CPUFreq support Sudeep Holla
2015-04-27 11:40 ` [PATCH 1/4] mailbox: add support for System Control and Power Interface(SCPI) protocol Sudeep Holla
2015-04-28  7:36   ` Paul Bolle
2015-04-28  8:41     ` Sudeep Holla
2015-04-28 13:54   ` Jon Medhurst (Tixy)
2015-04-29 10:53     ` Sudeep Holla
2015-04-29 11:43       ` Jon Medhurst (Tixy)
2015-04-29 12:25         ` Jon Medhurst (Tixy)
2015-04-29 13:08           ` Sudeep Holla
2015-04-30  8:49           ` Jon Medhurst (Tixy) [this message]
2015-04-29 13:01         ` Sudeep Holla
2015-05-13 16:52   ` Jassi Brar
2015-05-13 17:09     ` Sudeep Holla
2015-05-14  7:02       ` Jassi Brar
2015-05-14  7:30         ` Jassi Brar
2015-05-14  8:25           ` Sudeep Holla
2015-04-27 11:40 ` [PATCH 2/4] clk: add support for clocks provided by SCP(System Control Processor) Sudeep Holla
2015-05-07 10:17   ` Lorenzo Pieralisi
2015-05-20 23:43   ` Stephen Boyd
2015-05-26 13:14     ` Sudeep Holla
2015-04-27 11:40 ` [PATCH 3/4] clk: scpi: add support for cpufreq virtual device Sudeep Holla
2015-05-20 23:45   ` Stephen Boyd
2015-05-26 13:25     ` Sudeep Holla
2015-04-27 11:40 ` [PATCH 4/4] cpufreq: arm_big_little: add SCPI interface driver Sudeep Holla
2015-04-29  5:44   ` Viresh Kumar
2015-04-29  9:39     ` Sudeep Holla
2015-05-01 13:19   ` Jon Medhurst (Tixy)
2015-05-01 13:32     ` Sudeep Holla
2015-05-01 14:12       ` Jon Medhurst (Tixy)
2015-05-01 14:15         ` Sudeep Holla
2015-05-01 17:10           ` Jon Medhurst (Tixy)
2015-05-01 17:14             ` Sudeep Holla
2015-04-27 18:11 ` [PATCH 0/4] ARM64: add SCPI mailbox protocol, clock and CPUFreq support Jon Medhurst (Tixy)
2015-04-28  8:47   ` Sudeep Holla
2015-04-28 14:21   ` Sudeep Holla

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=1430383781.2868.9.camel@linaro.org \
    --to=tixy@linaro.org \
    --cc=Liviu.Dudau@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Mark.Rutland@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sudeep.holla@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).