From: Krzysztof Kozlowski <krzk@kernel.org>
To: Doug Anderson <dianders@chromium.org>,
Jassi Brar <jassisinghbrar@gmail.com>,
Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@kernel.org>
Cc: "Joonwon Kang" <joonwonkang@google.com>,
"Subhash Jadavani" <sjadavani@google.com>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Lucas Wei" <lucaswei@google.com>,
"Brian Norris" <briannorris@chromium.org>,
"Peter Griffin" <peter.griffin@linaro.org>,
"André Draszik" <andre.draszik@linaro.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>
Subject: Re: [PATCH 7/7] mailbox: goog-mba: Introduce the goog-mba mailbox driver
Date: Fri, 9 Oct 2026 08:36:32 +0200 [thread overview]
Message-ID: <b1f088eb-7c77-4079-9b05-20729fcfd612@kernel.org> (raw)
In-Reply-To: <CAD=FV=XGka_QqGt5iK53vU704ZsvCrXUWvJ9ewo1=TCiepfz-g@mail.gmail.com>
On 28/09/2026 23:34, Doug Anderson wrote:
>
> ```C
> static struct mbox_chan *goog_mba_fw_xlate(struct mbox_controller *mbox,
> const struct fwnode_reference_args *sp)
> {
> int i;
>
> if (sp->nargs)
> return ERR_PTR(-EINVAL);
>
> for (i = 0; i < mbox->num_chans; i++) {
> if (!mbox->chans[i].cl)
> return &mbox->chans[i];
> }
>
> return ERR_PTR(-EBUSY);
> }
> ```
>
> Then the client loops around and requests the same channel over and
> over again until it gets -EBUSY? Like:
>
> ```C
> for (i = 0; i < FIFO_MAX; i++) {
> client
> chan[i] = mbox_request_channel(client[i], TX_CHAN);
> if (IS_ERR(chan[i]) && PTR_ERR(chan[i]) == -EBUSY)
> break;
> }
> fifo_depth = i;
> ```
>
> I _guess_ that works, but it still feels like a bit of a hack to me.
> You said you were worried about people abusing the "has_queue" API.
> The above feels like it's abusing the "fw_xlate" API, turning it from
> something that is normally a "lookup" into an allocator function.
>
> +Rob, Saravana, and devicetree@vger.kernel.org. DT folks: is the above
> something that looks right to you?
There is no allocation in your xlate code above, so this is not that
terrible as we talked on LPC.
>
>
> I researched whether other upstream drivers use of_xlate() /
> fw_xlate() as an "allocator" like this. I did find "exynos-mailbox,"
> which appears to be doing something similar. However, upon deeper
> digging it seems like "exynos-mailbox" isn't using this dynamic
> allocation for any compelling reason. It looks like, really,
> "exynos-mailbox" should just be returning one channel. The client
> (exynos-acpm) could just use the same channel for everything since:
> * It actually gets the _real_ channel ID out of the data.
> * It doesn't care about txdone.
> * All it does is ring a doorbell and there's no queueing.
>
>
> In any case, if using fw_xlate() as an allocator is truly the only way
> to proceed, I'll finish my prototype and send a v2, but I'm still
Why fw_xlate() would be an allocator? Can you extend your code to show that?
I think doing any allocation in xlate() is calls is fundamentally wrong.
These should not modify the state of the device, so no allocations, no
device_link_add() etc.
Why? There is simply no corresponding xlate_destroy() call. It's also
confusing, because the meaning is to translate from one domain resource
to another, not perform actual resource allocation.
> skeptical that this is better than just adding queuing into the core.
> Speaking of which, I actually want to go back to something you said
> earlier. I asked a bit about this but I don't think I saw a response
> (sorry if I missed it!):
Best regards,
Krzysztof
next prev parent reply other threads:[~2026-10-09 6:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 22:21 [PATCH 0/7] mailbox: Improve the mbox core then introduce the goog-mba driver Douglas Anderson
2026-07-14 22:21 ` [PATCH 1/7] dt-bindings: mailbox: Don't require #mbox-cells to be 1 Douglas Anderson
2026-07-14 22:32 ` sashiko-bot
2026-07-22 14:02 ` Rob Herring
2026-08-04 20:42 ` Doug Anderson
2026-07-14 22:21 ` [PATCH 6/7] dt-bindings: mailbox: goog-mba: Add goog-mba mailbox bindings Douglas Anderson
2026-07-15 4:51 ` Krzysztof Kozlowski
2026-07-15 16:49 ` Doug Anderson
2026-07-16 5:46 ` Krzysztof Kozlowski
2026-07-16 16:31 ` Doug Anderson
2026-07-22 17:11 ` Doug Anderson
2026-07-29 13:27 ` Jassi Brar
2026-07-31 21:24 ` Doug Anderson
2026-07-22 14:10 ` Rob Herring
2026-07-22 16:57 ` Doug Anderson
[not found] ` <20260714152138.7.I5cef580a62c86ba6c3465ad336fa509afbdf1476@changeid>
[not found] ` <CABb+yY3_xBvQVFHEs=v39u7+TLjJRaVv3sg5pGgd0YxCruZ8Tw@mail.gmail.com>
[not found] ` <CAD=FV=X-fAJp=EG_yTAg+QQgNYRCt25947oHGHZuq-FEyirK0g@mail.gmail.com>
[not found] ` <CABb+yY2CH5A1ixfX9czgtEwsP95FN-2JVzN_wmRDRNsSuZY5PQ@mail.gmail.com>
[not found] ` <CAD=FV=XiguzS7nH1sE=BkXt+7G6-hhqyz5u3sjc4zAA9H7KqJg@mail.gmail.com>
[not found] ` <CABb+yY2_AvcnaTDmpL8gP4H2_Pp3HddrtNr5gvL4GCW2DPPvOw@mail.gmail.com>
[not found] ` <CAD=FV=VzJCb1nz+q5EZ33G5U6KZM_tXi8snL=KbUM3C5yymG4g@mail.gmail.com>
[not found] ` <CABb+yY2omp+g13UgZfiKWLux9J1P+=ed0U3F8AhS0iQK=kpN8w@mail.gmail.com>
[not found] ` <CAD=FV=WA2wFbk0=qFE0aZs9E5jg-EXzcrkPCk6VOMhbDroOQCw@mail.gmail.com>
[not found] ` <CABb+yY0W+244qaXqHdfEq9XFuQXBez7PVcDNrKooV9cFS8TS_Q@mail.gmail.com>
[not found] ` <CAD=FV=VW2h1zWDYWQ6LknX3O+3=EY665jde35Ly+UQzuscXy=Q@mail.gmail.com>
[not found] ` <CABb+yY2Cc9YGKb0ej7CZ_LQLw-iMQOtcAwLPier+X2ej1fWcJQ@mail.gmail.com>
[not found] ` <CAD=FV=U1DAuDN4eR_hZ2bbGoGkgkszDLPUDiosxh1aKg7Y1T=A@mail.gmail.com>
[not found] ` <CABb+yY3n3QmxTPOyAuHz9JkOKbhRqKok+24THc_JfdxwzROWDw@mail.gmail.com>
2026-09-28 21:34 ` [PATCH 7/7] mailbox: goog-mba: Introduce the goog-mba mailbox driver Doug Anderson
2026-10-09 6:36 ` Krzysztof Kozlowski [this message]
2026-10-09 8:41 ` Doug Anderson
2026-10-09 15:43 ` Jassi Brar
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=b1f088eb-7c77-4079-9b05-20729fcfd612@kernel.org \
--to=krzk@kernel.org \
--cc=andre.draszik@linaro.org \
--cc=briannorris@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=jassisinghbrar@gmail.com \
--cc=joonwonkang@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=lucaswei@google.com \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
--cc=sjadavani@google.com \
--cc=tudor.ambarus@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox