Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve RISC-V multi core boot #132

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

axel-h
Copy link
Member

@axel-h axel-h commented Nov 13, 2021

  • add much more comments
  • fix SBI HSM register naming quirk
  • Ensure DTB is always passed to primary core boot
  • check SBI HSM error when bringing up secondary harts
  • Stop wrong boot hart via HSM if possible
  • unify stack definitions for all cores
  • add multicore helper functions
  • Drop variable hsm_exists, pass information as parameter
  • Print more log messages

@yyshen
Copy link
Contributor

yyshen commented Dec 2, 2023

@axel-h thanks for the changes. I just want to double check if there are any bugs fixed in the PR.

@@ -176,17 +176,52 @@ int secondary_go = 0;
int next_logical_core_id = 1; /* incremented by assembly code */
int mutex = 0;
int core_ready[CONFIG_MAX_NUM_NODES] = { 0 };

static void acquire_multicore_lock(void)
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this is used inside this file only, maybe smp_lock and smp_unlock are shorter. just a suggestion.

__atomic_store_n(&mutex, 0, __ATOMIC_RELEASE);
}

static void set_secondary_cores_go(void)
Copy link
Contributor

Choose a reason for hiding this comment

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

unleash_secondary_cores?


_start1: /* a0 must hold current hard ID passed by bootloader */
/* a1 must hold dtb address passed by bootloader */
/*----------------------------------------------------------------------------*/
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

so this basically has no code logic changes? In this case, maybe we should state it in the commit message clearly.

@@ -220,6 +220,7 @@ static int run_elfloader(UNUSED word_t hart_id, void *bootloader_dtb)
}

#if CONFIG_MAX_NUM_NODES > 1

Copy link
Contributor

Choose a reason for hiding this comment

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

why are the additional empty lines?

@axel-h axel-h added the hw-build enable all sel4test hardware builds label Jan 15, 2024
- Use word_t to adapt to architecture
- sbi_hart_start() takes a custom argument.
- hart ID and custom argument is passed when starting a secondary hart.

Signed-off-by: Axel Heider <axelheider@gmx.de>
This also makes the comment about a1 correct again.

Signed-off-by: Axel Heider <axelheider@gmx.de>
- declare stack fully in C code
- use one array that holds all stack
- use CONFIG_KERNEL_STACK_BITS for size

Signed-off-by: Axel Heider <axelheider@gmx.de>
Signed-off-by: Axel Heider <axelheider@gmx.de>
Reorder code blocks and improve comments.

Signed-off-by: Axel Heider <axelheider@gmx.de>
Use wrapper function to Improve code readability.

Signed-off-by: Axel Heider <axelheider@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup hw-build enable all sel4test hardware builds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants