linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@google.com>
To: "allen-kh.cheng" <allen-kh.cheng@mediatek.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"cujomalainey@google.com" <cujomalainey@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Takashi Iwai <tiwai@suse.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Project_Global_Chrome_Upstream_Group 
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	Mark Brown <broonie@kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"sound-open-firmware@alsa-project.org" 
	<sound-open-firmware@alsa-project.org>
Subject: Re: [PATCH v3 2/3] mailbox: mediatek: add support for adsp mailbox controller
Date: Thu, 25 Nov 2021 14:23:48 +0800	[thread overview]
Message-ID: <YZ8r9GvUFqkGCqSz@google.com> (raw)
In-Reply-To: <f3642bcd031fbfd461b5efae1eba4816cc4856b2.camel@mediatek.com>

On Thu, Nov 25, 2021 at 09:51:27AM +0800, allen-kh.cheng wrote:
> On Wed, 2021-11-24 at 18:25 +0800, Tzung-Bi Shih wrote:
> > > On Wed, Nov 24, 2021 at 04:45:13PM +0800, allen-kh.cheng wrote:
> > > > > +static int mtk_adsp_mbox_send_data(struct mbox_chan *chan,
> > > void
> > > > > *data)
> > > > > +{
> > > > > +  struct adsp_mbox_ch_info *ch_info = chan->con_priv;
> > > > > +  void __iomem *reg = ch_info->va_reg;
> > > > > +
> > > > > +  spin_lock(&ch_info->lock);
> > > > > +  writel(ch_info->ipc_op_val, reg + MTK_ADSP_MBOX_IN_CMD);
> > > > > +  spin_unlock(&ch_info->lock);
> > 
> > >
> > > Why does it need the lock?
> > >
> > > Is the write to MTK_ADSP_MBOX_IN_CMD a synchronous operation?
> > > - If yes, I failed to understand why does it need the lock.  Every
> > > calls to mtk_adsp_mbox_send_data() should wait for the data
> > transfer
> > > completion.
> > > - If no, I also failed to understand
> > why.  mtk_adsp_mbox_send_data()
> > > has no way to be aware of the transfer completion.  Would expect a
> > > loop for checking the completion for the case.
> > >
> >  
> 
> In ADSP MBOX IPC flow,
>  
> Host would call mbox send data when the shared data transfer completed.
>  
> (mtk_adsp_mbox_send_data will notice client using MTK_ADSP_MBOX_IN_CMD)
>  
> It’s more like a signal.
>  
> In general case,
>  
> There may be some hosts use the same mbox channel.
>  
> I think it’s better using lock to protect access to
> MTK_ADSP_MBOX_IN_CMD registers

I still failed to understand.  What if 2 hosts notify the same client by writing MTK_ADSP_MBOX_IN_CMD at the same time?

  parent reply	other threads:[~2021-11-25  6:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211124084514.28002-1-allen-kh.cheng@mediatek.com>
     [not found] ` <20211124084514.28002-3-allen-kh.cheng@mediatek.com>
2021-11-24 10:25   ` [PATCH v3 2/3] mailbox: mediatek: add support for adsp mailbox controller Tzung-Bi Shih
     [not found]     ` <f3642bcd031fbfd461b5efae1eba4816cc4856b2.camel@mediatek.com>
2021-11-25  6:23       ` Tzung-Bi Shih [this message]
     [not found] ` <20211124084514.28002-4-allen-kh.cheng@mediatek.com>
2021-11-24 10:25   ` [PATCH v3 3/3] firmware: mediatek: add adsp ipc protocol interface Tzung-Bi Shih
     [not found]     ` <43976e8aab2e3055195d8e9c2f466a804e4d2ba7.camel@mediatek.com>
2021-11-25  6:26       ` Tzung-Bi Shih

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=YZ8r9GvUFqkGCqSz@google.com \
    --to=tzungbi@google.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=allen-kh.cheng@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@google.com \
    --cc=daniel.baluta@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.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 NNTP newsgroup(s).