cederom commented on code in PR #18861:
URL: https://github.com/apache/nuttx/pull/18861#discussion_r3222709811
##########
arch/arm64/src/bcm2711/bcm2711_boot.c:
##########
@@ -124,7 +132,44 @@ int arm64_get_cpuid(uint64_t mpid)
void arm64_el_init(void)
{
- /* TODO: what goes here? */
+ /* According to the bcm2711.dtsi file in the Linux source tree [1], the
+ * CPUs on the BCM2711 use a spin-table enable method and poll the
+ * following addresses:
+ *
+ * CPU0: 0x000000d8 (BCM_MBOX_CLR06)
+ * CPU1: 0x000000e0 (BCM_MBOX_CLR08)
+ * CPU2: 0x000000e8 (BCM_MBOX_CLR10)
+ * CPU3: 0x000000f0 (BCM_MBOX_CLR12)
+ *
+ * Some kernel docs about booting [2] have a handy explanation of how this
+ * works:
+ *
+ * "polling their cpu-release-addr location, which must be contained in the
+ * reserved region ... when a read of the location pointed to by the
+ * cpu-release-addr returns a non-zero value, the CPU must jump to this
+ * value" [2]
+ *
+ * In our case, we want these CPUs to load the NuttX kernel defined by
+ * `_start`. We don't need to worry about CPU0, that one always starts.
+ * These are 64-bit words (hence skipping every second register).
+ *
+ * [1] https://github.com/raspberrypi/linux/blob/rpi-6.12.y/
+ * arch/arm/boot/dts/broadcom/bcm2711.dtsi
+ *
+ * [2] https://www.kernel.org/doc/Documentation/arm64/booting.txt
+ */
+
+#ifdef CONFIG_SMP
+
+ for (uint8_t cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
+ {
+ putreg64((uint64_t)_start, BCM_SPINTBL_CPU(cpu));
Review Comment:
@linguini1 please take a look at a bit lengthy search in the PR comments,
looks like there is instrumentation already, we need to set `CONFIG_SMP_NCPUS`
in the configuration? If that does not work then probably this arch specific
code would go to `arch/arm64/bcm2711/bcm2711_cpustart.c` ? :-)
Also `CONFIG_SCHED_INSTRUMENTATION` may be our friend here :-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]