From: "Echo Zhang (张玉)" <Echo.Zhang@mediatek.com>
To: Ben Grisdale <bengris32@protonmail.ch>
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Brian Masney" <bmasney+clk@redhat.com>,
"Jerome Brunet" <jbrunet+clk@baylibre.com>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"MMDVFS Team" <linux-mediatek@lists.infradead.org>,
"Kyrie Wu (吴晗)" <Kyrie.Wu@mediatek.com>,
"Ming-Fan Chen (陳明汎)" <Ming-Fan.Chen@mediatek.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"llvm@lists.linux.dev" <llvm@lists.linux.dev>
Subject: Re: [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend
Date: Thu, 26 Nov 2026 09:03:39 +0000 [thread overview]
Message-ID: <beab80959fa22a1c8647131ed3953a273e43c449.camel@mediatek.com> (raw)
Hi Ben,
Thank you for the detailed review. I agree that reading the
Android-specific atag,boot property and using it to skip IPI
transactions in recovery mode does not belong in this driver. That
behavior came from the downstream implementation and should not have
been carried into this series.
In v2, I will remove mmdvfs_get_bootmode(), the RECOVERY_BOOT check
in
mmdvfs_vcp_send_ipi_impl(), and the associated bootmode state. I will
also rework the VCP readiness and error paths so that unavailable
firmware is handled through normal driver mechanisms, without a
bootmode check. Whether the device is enabled or the module is loaded
for a particular environment belongs in platform configuration.
Thanks,
Echo
On 三, 2026-11-25 at 14:32 +0000, Ben Grisdale wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On Wed, 25 Nov 2026 14:00:09 +0800 "Echo Zhang"
> <echo.zhang@mediatek.com> wrote:
>
> > Add the VCP transport used by MMDVFS to map AP and firmware shared
> > memory, manage feature power references and send IPI commands.
> >
> > Wait for VCP readiness and handle the selected MMUP or VCP READY
> > notification to initialize firmware after boot and resume.
> > Serialize
> > IPI transactions while shared memory and acknowledgment state are
> > in
> > use.
>
> [...]
>
> > +static void mmdvfs_get_bootmode(void)
> > +{
> > + struct device_node *np_chosen;
> > + struct tag_bootmode {
> > + u32 size;
> > + u32 tag;
> > + u32 bootmode;
> > + u32 boottype;
> > + } *tag;
> > +
> > + if (bootmode < UNKNOWN_BOOT)
> > + return;
> > +
> > + np_chosen = of_find_node_by_path("/chosen");
> > + if (!np_chosen) {
> > + bootmode = NORMAL_BOOT;
> > + return;
> > + }
> > +
> > + tag = (struct tag_bootmode *)of_get_property(np_chosen,
> > "atag,boot", NULL);
> > + of_node_put(np_chosen);
> > +
> > + if (tag)
> > + bootmode = tag->bootmode;
> > + else
> > + bootmode = NORMAL_BOOT;
> > +}
> > +
>
> [...]
>
> > +static int
> > +mmdvfs_vcp_send_ipi_impl(struct mmdvfs_device *mmdvfs, void *data,
> > u32 len,
> > + const bool vcp)
> > +{
> [...]
> > + mmdvfs_get_bootmode();
> > + if (bootmode == RECOVERY_BOOT) {
> > + mmdvfs_err(mmdvfs->dev, "IPI skipped: bootmode=%d\n",
> > bootmode);
> > + return -EACCES;
> > + }
> > +
>
> Allow me to give my two cents here, even if I am a nobody :)
>
> Android bootmodes. Whilst I do respect the reason for Android
> bootmodes
> existing, what I do not like to see is people checking for the
> *Android*
> bootmode in their drivers.
>
> Android kernels these days are *modular* thanks to GKI. I *do not*
> understand why people still check for bootmodes in their drivers when
> there is a much better option of *not loading them* if they are not
> wanted in the current bootmode.
>
> Having your driver depend on the behaviour of one specific userspace
> is
> terrible. And tracking it in firmware (given that this code is
> checking
> for an "atag,boot" property presumably added by the bootloader) is
> even
> worse.
>
> Aside from enabling these questionable bootmode checks in the
> drivers,
> I have no idea why the bootloader needs to get involved with putting
> non-standard state / boot info inside of /chosen (i.e. that
> "atag,boot"
> property), when Android solved this problem by using bootargs, and
> more
> recently, bootconfig.
>
> I will acknowledge that "just not loading modules" does get a bit
> more
> nuanced if you bring something like udev / Android init into the mix,
> but there are still better solutions to this problem: either
> gracefully
> handling the state where the hardware isn't ready in your driver,
> making
> your bootloader set status = "disabled"; on the relavent DT node, or
> blocklisting the module from userspace in boot modes where it can't
> work.
>
> Inter-driver dependencies are not a good excuse either (e.g. a core
> clock driver depending on some DVFS driver that is a no-op in
> recovery,
> forcing you to load it ANYWAY, even if the bootloader doesn't start
> the
> required firmware on recovery boot). If that is the case, then there
> is
> some serious refactoring work to do.
>
> First I began seeing these sorts of checks in vendor touch screen
> drivers, but now it seems to be infecting SoC side drivers as well.
>
> *Kernel* drivers should work the same regardless of what *userspace*
> environment is running (with the only real exception being the
> absence
> of firmware or explicit configurations from userspace). And in
> situations
> where they genuinely can't work, they should not be loaded at all.
>
> There should be no such thing as "kernel drivers designed for
> Android",
> only "kernel drivers designed for Linux".
>
> Best regards,
> Ben Grisdale
>
next reply other threads:[~2026-11-26 9:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 9:03 Echo Zhang (张玉) [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-26 9:15 Echo Zhang (张玉)
2026-11-25 6:00 [PATCH 0/7] soc: mediatek: add MMDVFS support for MT8196 Echo Zhang
2026-11-25 6:00 ` [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend Echo Zhang
2026-11-25 8:38 ` Roman Vivchar
2026-11-25 10:59 ` Krzysztof Kozlowski
2026-11-25 11:00 ` Krzysztof Kozlowski
2026-11-25 14:32 ` Ben Grisdale
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=beab80959fa22a1c8647131ed3953a273e43c449.camel@mediatek.com \
--to=echo.zhang@mediatek.com \
--cc=Kyrie.Wu@mediatek.com \
--cc=Ming-Fan.Chen@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bengris32@protonmail.ch \
--cc=bmasney+clk@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jbrunet+clk@baylibre.com \
--cc=justinstitt@google.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=llvm@lists.linux.dev \
--cc=matthias.bgg@gmail.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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
all inboxes | Powered by JetHome®