Hi Clément,

On 5/1/24 11:24, Clément Chigot wrote:
This implements the multiprocessor status register in grlib-irqmp and bind
it to a start signal, which will be later wired in leon3-generic to
start a cpu.

Co-developed-by: Frederic Konrad <konrad.frede...@yahoo.fr>
Signed-off-by: Clément Chigot <chi...@adacore.com>
---
  hw/intc/grlib_irqmp.c | 22 +++++++++++++++++++---
  1 file changed, 19 insertions(+), 3 deletions(-)


@@ -323,6 +334,8 @@ static void grlib_irqmp_reset(DeviceState *d)
memset(irqmp->state, 0, sizeof *irqmp->state);
      irqmp->state->parent = irqmp;
+    irqmp->state->mpstatus = ((irqmp->ncpus - 1) << 28)

Can you #define this magic '28' number?

+        | ((1 << irqmp->ncpus) - 2);
  }
static void grlib_irqmp_realize(DeviceState *dev, Error **errp)
@@ -336,6 +349,9 @@ static void grlib_irqmp_realize(DeviceState *dev, Error 
**errp)
      }
qdev_init_gpio_in(dev, grlib_irqmp_set_irq, MAX_PILS);
+    /* Transitionning from 0 to 1 starts the CPUs.  */

What about 1 -> 0?

+    qdev_init_gpio_out_named(dev, irqmp->start_signal, "grlib-start-cpu",
+                             IRQMP_MAX_CPU);
      qdev_init_gpio_out_named(dev, &irqmp->irq, "grlib-irq", 1);
      memory_region_init_io(&irqmp->iomem, OBJECT(dev), &grlib_irqmp_ops, irqmp,
                            "irqmp", IRQMP_REG_SIZE);


Reply via email to