Skip to content

smp regression on current main #493

@midnightveil

Description

@midnightveil

Since commit a683b3c the microkit has been unable to boot on SMP mode now.

Specifically, the change from used the reserved value of 0b0100 (the Stage-1 MT_NORMAL) to the correct value of 0b1111 (the Stage 2 equivalent) broke the kernel booting.

Filing this to make people aware; I am going to be filing upstream issues soon, but there are a few consequences.

ERROR: can't get kernel image!
u-boot=> go ${loadaddr}
go ${loadaddr}
## Starting application at 0x50000000 ...
LDR|INFO|CPU0: CurrentEL=EL2
LDR|INFO|CPU0: Resetting CNTVOFF
LDR|INFO: disabling MMU (if it was enabled)
LDR|INFO: PSCI version is 1.1
LDR|INFO: loader for seL4 starting
LDR|INFO: flags:
             seL4 configured as hypervisor
LDR|INFO: kernel:      entry:   0x0000008040000000
LDR|INFO: root server: physmem: 0x0000000040260000 -- 0x00000000402b9000
LDR|INFO:              virtmem: 0x0000000000200000 -- 0x0000000000259000
LDR|INFO:              entry  : 0x000000000022233c
LDR|INFO: region: 0x00000000   addr: 0x0000000040000000   size: 0x0000000000260000   offset: 0x0000000000000000   type: 0x0000000000000001
LDR|INFO: region: 0x00000001   addr: 0x0000000040260000   size: 0x000000000000a914   offset: 0x0000000000260000   type: 0x0000000000000001
LDR|INFO: region: 0x00000002   addr: 0x000000004027a918   size: 0x00000000000141f8   offset: 0x000000000026a914   type: 0x0000000000000001
LDR|INFO: region: 0x00000003   addr: 0x000000004029eb10   size: 0x00000000000100b0   offset: 0x000000000027eb0c   type: 0x0000000000000001
LDR|INFO: region: 0x00000004   addr: 0x00000000402af000   size: 0x0000000000001328   offset: 0x000000000028ebbc   type: 0x0000000000000001
LDR|INFO: region: 0x00000005   addr: 0x00000000402b1000   size: 0x0000000000008000   offset: 0x000000000028fee4   type: 0x0000000000000001
LDR|INFO: copying region 0x00000000
LDR|INFO: copying region 0x00000001
LDR|INFO: copying region 0x00000002
LDR|INFO: copying region 0x00000003
LDR|INFO: copying region 0x00000004
LDR|INFO: copying region 0x00000005
LDR|INFO|CPU0: active CPUs to start: 0x00000004
LDR|INFO|CPU0: starting CPU 1
LDR|INFO|CPU1: secondary CPU entry with MPIDR_EL1 0x0000000080000001
LDR|INFO|CPU1: enabling MMU
LDR|INFO|CPU1: CurrentEL=EL2
LDR|INFO|CPU1: Resetting CNTVOFF
LDR|INFO|CPU1: enabling MMU
LDR|INFO|CPU1: jumping to kernel
LDR|INFO|CPU0: starting CPU 2
LDR|INFO|CPU2: secondary CPU entry with MPIDR_EL1 0x0000000080000002
LDR|INFO|CPU2: enabling MMU
LDR|INFO|CPU2: CurrentEL=EL2
LDR|INFO|CPU2: Resetting CNTVOFF
LDR|INFO|CPU2: enabling MMU
LDR|INFO|CPU2: jumping to kernel
LDR|INFO|CPU0: starting CPU 3
LDR|INFO|CPU3: secondary CPU entry with MPIDR_EL1 0x0000000080000003
LDR|INFO|CPU3: enabling MMU
LDR|INFO|CPU3: CurrentEL=EL2
LDR|INFO|CPU3: Resetting CNTVOFF
LDR|INFO|CPU3: enabling MMU
LDR|INFO|CPU3: jumping to kernel
LDR|INFO|CPU0: enabling MMU
LDR|INFO|CPU0: CurrentEL=EL2
LDR|INFO|CPU0: Resetting CNTVOFF
LDR|INFO|CPU0: enabling MMU
LDR|INFO|CPU0: jumping to kernel
Bootstrapping kernel
available phys memory regions: 1
  [40000000..c0000000)
reserved virt address space regions: 2
  [8040000000..8040260000)
  [8040260000..80402b9000)

[[[ HANGS ]]]

A hotfix is below: this makes the tool boot SMP for me.

diff --git a/tool/microkit/src/loader.rs b/tool/microkit/src/loader.rs
index fcf875e..fd22169 100644
--- a/tool/microkit/src/loader.rs
+++ b/tool/microkit/src/loader.rs
@@ -105,7 +105,8 @@ pub mod aarch64 {

         pub const NORMAL_INNER_NC_OUTER_WBC: u64 = 0b1101;
         pub const NORMAL_INNER_WTC_OUTER_WBC: u64 = 0b1110;
-        pub const NORMAL_INNER_WBC_OUTER_WBC: u64 = 0b1111;
+
+        pub const NORMAL_INNER_WBC_OUTER_WBC: u64 = super::s1_mair_attr_index::MT_NORMAL;
     }

     pub mod descriptor_type {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions