Re: [PATCH v1 05/15] remoteproc: mediatek: Add SCP core 1 driver for dual-core scp

From: AngeloGioacchino Del Regno
Date: Mon Jun 06 2022 - 06:11:47 EST


Il 06/06/22 11:52, Tinghan Shen ha scritto:
On Mon, 2022-06-06 at 11:15 +0200, AngeloGioacchino Del Regno wrote:
Il 01/06/22 13:21, Tinghan Shen ha scritto:
MT8195 SCP is a dual-core processor. The mtk_scp.c driver only controls
SCP core 0. This patch adds a basic driver to control the another core.

Core 1 and core 0 of the SCP are housed in the same subsys.They see
registers and memory in the same way.

Core 1 of the SCP features its own set of core configuration registers,
interrupt controller, timers, and DMAs. The rest of the peripherals
in this subsystem are shared by core 0 and core 1.

As for memory, core 1 has its own cache memory, and the SCP SRAM is shared
by core 0 and core 1.


Hello Tinghan,

checking all the patches that are introducing support for the secondary SCP core,
it's clear that you're practically reusing *most of* mtk_scp in mtk_scp_dual.

I don't think that adding a new configuration option for MTK_SCP_DUALCORE (nor a
new file just for that) is a good idea... the code is "short enough" so you should
really just add support for multi-core SCP in mtk_scp.c instead.

After doing so, I have a hunch that we'll be able to reduce the size of this
implementation even more, as I see literally too much common code :-)


Hi Angelo,

Thanks for your review.

This series has 2 new files, mtk_scp_dual.c and mtk_scp_subdev.c.
Is your advice to merge both files into mtk_scp.c,
or to merely merge mtk_scp_dual.c to mtk_scp.c?

Thanks,
TingHan




I suggest to merge both into mtk_scp.c and commonize/generalize functions inside
of there as much as possible... including the removal of #if IS_ENABLED(...)
macro usages, as you can simply check that during runtime by setting a bool
variable to true when it's dual-core.

Let's do this first step.
I'll give you a more exhaustive review on v2, when this main step is done.

Cheers,
Angelo