Hi Gaurav,
On 19/5/26 19:56, Gaurav Sharma wrote:
Configure the i.MX8MP to boot the Cortex-M7 core alongside
the Cortex-A53 cores in an Asymmetric Multiprocessing (AMP)
configuration. The M7 firmware can be loaded and started from Linux
running on the A53 cores via the remoteproc framework.
CM7 boot is made optional. A GPR IRQ is connected to a cpuwait handler.
The handler translates the CPUWAIT into STOP and RUN.It follows the
classic Cortex-M boot sequence: initial SP and reset vector taken from
the vector table.
Signed-off-by: Gaurav Sharma <[email protected]>
---
docs/system/arm/imx8m.rst | 86 +++++++++++++++++++++-
hw/arm/fsl-imx8mp.c | 143 ++++++++++++++++++++++++++++++++++++
include/hw/arm/fsl-imx8mp.h | 13 +++-
3 files changed, 240 insertions(+), 2 deletions(-)
@@ -72,7 +155,8 @@ For i.MX 8M Plus EVK:
.. code-block:: bash
$ qemu-system-aarch64 -M imx8mp-evk \
- -display none -serial null -serial stdio \
+ -display none -serial null -serial stdio -serial null -serial
/tmp/imx8mp-uart4 \
+ -smp 4,maxcpus=5 -global fsl-imx8mp.enable-cm7=on \
Not a blocker; I wonder if this is a good use of the -smp/maxcpus
(thinking about long term AMP modelling).
Maybe we could use a machine property for the M core, and keep the
smp default value to the A core cluster:
-M imx8mp-evk,enable_cm7=on -smp 4
But IMHO even better is to always create all cores like on real
hardware. If the M7 is not used it is just sitting here, created
and halted, not disturbing anything. Personally I'd rather not
accepting any -smp option for such machine, just reporting an
error if used "Can not restrict this machine, it is always
created with 4 Cortex A and 1 Cortex M".
static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
{
MachineState *ms = MACHINE(qdev_get_machine());
@@ -277,6 +368,23 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error
**errp)
const char *cpu_type = ms->cpu_type ?: ARM_CPU_TYPE_NAME("cortex-a53");
int i;
+ if (!s->enable_cm7) {
+ object_unparent(OBJECT(&s->cm7));
+ } else {
+ /*
+ * When CM7 is enabled we need one additional vCPU
+ * slot. If the user does not specify maxcpus=,
+ * QEMU defaults maxcpus to the current -smp count.
+ */
+ unsigned int need = ms->smp.cpus + 1;
+ if (ms->smp.max_cpus < need) {
+ error_setg(errp,
+ "CM7 enabled requires -smp %u,maxcpus=%u (one extra vCPU
slot for CM7)",
+ ms->smp.cpus, need);
+ return;
+ }
+ }