Re: [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend

From: Echo Zhang (张玉)

Date: Thu Nov 26 2026 - 04:04:09 EST


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@xxxxxxxxxxxx> 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
>