Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion loader/src/aarch64/cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int plat_start_cpu(int logical_cpu)
while (__atomic_load_n(&arm_spin_table_secondary_cpu_data, __ATOMIC_ACQUIRE) != 0);
arm_spin_table_cpu_start(logical_cpu, (uint64_t)sp);
return 0;
#else
#elif !defined(ARM_PSCI_UNAVAILABLE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to have it as like, SMP_BOOT_METHOD == ARM_PSCI or SMP_BOOT_METHOD == SPIN_TABLE or w/e (not if-def'd)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked in-person with @midnightveil , SMP_BOOT_METHOD doesn't really work well when you still need to skip PSCI version checking.

uint64_t ret = arm_smc64_call(
PSCI_FUNCTION_CPU_ON,
/* target_cpu */ psci_target_cpus[logical_cpu],
Expand All @@ -204,5 +204,8 @@ int plat_start_cpu(int logical_cpu)
}

return ret;
#else
LDR_PRINT("ERROR", 0, "unknown CPU start method for this platform");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might as well be a compile error?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved offline, cpus.c is always compiled so would need to split it out for exceptions where SMP is just unsupported (e.g Kria26). Just leave as run-time error for now...

return -1;
#endif
}
4 changes: 2 additions & 2 deletions loader/src/aarch64/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "../arch.h"
#include "../loader.h"
#include "../uart.h"
#include "../cpus.h"
#include "el.h"
#include "smc.h"

Expand Down Expand Up @@ -105,8 +106,7 @@ void arch_init(void)
fail();
}

// TODO: handle non-PSCI platforms better, see https://github.com/seL4/microkit/issues/401.
#if !defined(CONFIG_PLAT_BCM2711) && !defined(BOARD_kria_k26)
#if !defined(ARM_PSCI_UNAVAILABLE)
uint32_t ret = arm_smc32_call(PSCI_FUNCTION_VERSION, /* unused */ 0, 0, 0);
/* the return value has no error codes, but if we get it wrong this is what we will get */
if (ret == PSCI_RETURN_NOT_SUPPORTED) {
Expand Down
5 changes: 5 additions & 0 deletions loader/src/cpus.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

#include <kernel/gen_config.h>

#if defined(CONFIG_PLAT_BCM2711) || defined(BOARD_kria_k26)
/* There are a couple of cases where we cannot rely on having ARM PSCI available. */
#define ARM_PSCI_UNAVAILABLE
#endif

/* Define our own variant of the seL4 config */
#define NUM_ACTIVE_CPUS CONFIG_MAX_NUM_NODES

Expand Down
Loading