Skip to content

jh7100: fix hang during os boot by not to choose hart0 #2

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

Open
wants to merge 1 commit into
base: Fedora
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion lib/sbi/sbi_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ u32 sbi_platform_hart_index(const struct sbi_platform *plat, u32 hartid)
return -1U;
if (plat->hart_index2id) {
for (i = 0; i < plat->hart_count; i++) {
if (plat->hart_index2id[i] == hartid)
sbi_printf("sbi_platform_hart_index: i=%d hart_index2id=%d\n",
i, plat->hart_index2id[i]);
if (plat->hart_index2id[i] == hartid) {
sbi_printf("sbi_platform_hart_index: matched=%d\n",
hartid);
return i;
}
}
return -1U;
}
Expand Down
10 changes: 8 additions & 2 deletions platform/starfive/vic7100/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/* clang-format off */

#define VIC7100_HART_COUNT 2
#define VIC7100_HART_COUNT 3

#define VIC7100_SYS_CLK 1000000000

Expand Down Expand Up @@ -210,6 +210,11 @@ static int vic7100_vendor_ext_provider(long extid, long funcid,
return ret;
}

static u32 vic7100_hart_index2id[VIC7100_HART_COUNT - 1] = {
[0] = 1,
[1] = 2,
};

const struct sbi_platform_operations platform_ops = {
.final_init = vic7100_final_init,
.console_putc = uart8250_putc,
Expand All @@ -234,7 +239,8 @@ const struct sbi_platform platform = {
.platform_version = SBI_PLATFORM_VERSION(0x0, 0x01),
.name = "StarFive VIC7100",
.features = SBI_PLATFORM_DEFAULT_FEATURES,
.hart_count = (VIC7100_HART_COUNT),
.hart_count = (VIC7100_HART_COUNT - 1),
.hart_index2id = vic7100_hart_index2id,
.hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE,
.platform_ops_addr = (unsigned long)&platform_ops
};