[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1538965746.4271.20.camel@mhfsdcap03>
Date: Mon, 8 Oct 2018 10:29:06 +0800
From: houlong wei <houlong.wei@...iatek.com>
To: Matthias Brugger <matthias.bgg@...il.com>
CC: Jassi Brar <jassisinghbrar@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Daniel Kurtz <djkurtz@...omium.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
srv_heupstream <srv_heupstream@...iatek.com>,
Sascha Hauer <kernel@...gutronix.de>,
Philipp Zabel <p.zabel@...gutronix.de>,
"Nicolas Boichat" <drinkcat@...omium.org>,
CK Hu (胡俊光)
<ck.hu@...iatek.com>,
"Bibby Hsieh (謝濟遠)"
<Bibby.Hsieh@...iatek.com>,
YT Shen (沈岳霆)
<Yt.Shen@...iatek.com>,
Daoyuan Huang (黃道原)
<Daoyuan.Huang@...iatek.com>,
Jiaguang Zhang (张加广)
<Jiaguang.Zhang@...iatek.com>,
Dennis-YC Hsieh (謝宇哲)
<Dennis-YC.Hsieh@...iatek.com>,
Monica Wang (王孟婷)
<monica.wang@...iatek.com>,
Hs Liao (廖宏祥)
<Hs.Liao@...iatek.com>,
Ginny Chen (陳治傑)
<ginny.chen@...iatek.com>,
Enzhu Wang (王恩柱)
<enzhu.wang@...iatek.com>, <houlong.wei@...iatek.com>
Subject: Re: [PATCH v25 2/2] soc: mediatek: Add Mediatek CMDQ helper
On Sat, 2018-09-29 at 20:50 +0800, Matthias Brugger wrote:
>
> On 29/09/2018 11:21, Houlong Wei wrote:
> [...]
>
> > +static int cmdq_pkt_append_command(struct cmdq_pkt *pkt, enum cmdq_code code,
> > + u32 arg_a, u32 arg_b)
> > +{
> > + u64 *cmd_ptr;
> > +
> > + if (unlikely(pkt->cmd_buf_size + CMDQ_INST_SIZE > pkt->buf_size)) {
> > + pkt->cmd_buf_size += CMDQ_INST_SIZE;
>
> Can you plesae provide some example code of a driver that will use this API, I
> still don't understand why you need to update the cmd_buf_size here.
In our previous design, when appending a new command to buffer and the
buffer gets overflow, we will re-allocate a larger buffer to use.
CK.Hu had concern about the performance of buffer re-allocation. Please
refer:
http://lists.infradead.org/pipermail/linux-mediatek/2018-June/013797.html
One of his suggestions is that the consumer dynamically allocates buffer
with a initial size. Because the consumer doesn't know how to calculate
the buffer size. So we increase cmdq_buf_size here, that will help the
consumer get the buffer size in developing phase. In release driver
code, consumer passes a constant value to function call
cmdq_pkt_create(client, cmdq_buffer_size), cmdq_buffer_size is the
specified command queue buffer size.
>
> > + WARN_ON(1);
>
> can we add some debug information:
> WARN_ON(1, "%s: buffer size too small for the amount of commands", __func__);
>
> Would it make sense to use WARN_ONCE()?
>
Yes, I will add debug information and use WARN_ONCE().
> > + return -ENOMEM;
> > + }
> > + cmd_ptr = pkt->va_base + pkt->cmd_buf_size;
> > + (*cmd_ptr) = (u64)((code << CMDQ_OP_CODE_SHIFT) | arg_a) << 32 | arg_b;
> > + pkt->cmd_buf_size += CMDQ_INST_SIZE;
> > +
> > + return 0;
> > +}
>
> Thanks,
> Matthias
Powered by blists - more mailing lists