forked from Mirrors/opensbi
Introduce hart disabled parameter in platform.
As of now, uboot doesn't have support for SMP. Moreover, unleashed board has a E51 hart which doesn't not support S mode. We should only boot only 1 non-zero hart. Signed-off-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -33,6 +33,7 @@ struct sbi_platform {
|
||||
u64 features;
|
||||
u32 hart_count;
|
||||
u32 hart_stack_size;
|
||||
u64 disabled_hart_mask;
|
||||
int (*cold_early_init)(void);
|
||||
int (*cold_final_init)(void);
|
||||
int (*warm_early_init)(u32 target_hart);
|
||||
@@ -83,6 +84,13 @@ static inline const char *sbi_platform_name(struct sbi_platform *plat)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool sbi_platform_hart_disabled(struct sbi_platform *plat, u32 hartid)
|
||||
{
|
||||
if (plat && (plat->disabled_hart_mask & (1 << hartid)))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
static inline u32 sbi_platform_hart_count(struct sbi_platform *plat)
|
||||
{
|
||||
if (plat)
|
||||
|
@@ -211,8 +211,6 @@ int sbi_hart_init(struct sbi_scratch *scratch, u32 hartid)
|
||||
|
||||
void __attribute__((noreturn)) sbi_hart_hang(void)
|
||||
{
|
||||
sbi_printf("\nHART%u Hang !!\n\n", sbi_current_hartid());
|
||||
|
||||
while (1)
|
||||
wfi();
|
||||
__builtin_unreachable();
|
||||
|
@@ -86,7 +86,6 @@ static void __attribute__((noreturn)) init_coldboot(struct sbi_scratch *scratch,
|
||||
sbi_printf("OpenSBI v%d.%d (%s %s)\n",
|
||||
OPENSBI_MAJOR, OPENSBI_MINOR,
|
||||
__DATE__, __TIME__);
|
||||
sbi_printf("Running on Hart %u\n", hartid);
|
||||
|
||||
sbi_printf("%s\n", logo);
|
||||
|
||||
@@ -95,6 +94,7 @@ static void __attribute__((noreturn)) init_coldboot(struct sbi_scratch *scratch,
|
||||
sbi_printf("Platform HART Features : RV%d%s\n", misa_xlen(), str);
|
||||
sbi_printf("Platform Max HARTs : %d\n",
|
||||
sbi_platform_hart_count(plat));
|
||||
sbi_printf("Current Hart : %u\n", hartid);
|
||||
/* Firmware details */
|
||||
sbi_printf("Firmware Base : 0x%lx\n", scratch->fw_start);
|
||||
sbi_printf("Firmware Size : %d KB\n",
|
||||
@@ -106,11 +106,9 @@ static void __attribute__((noreturn)) init_coldboot(struct sbi_scratch *scratch,
|
||||
|
||||
sbi_hart_pmp_dump(scratch);
|
||||
|
||||
sbi_hart_mark_available(hartid);
|
||||
|
||||
if (!sbi_platform_has_hart_hotplug(plat))
|
||||
sbi_hart_wake_coldboot_harts(scratch, hartid);
|
||||
|
||||
sbi_hart_mark_available(hartid);
|
||||
sbi_hart_switch_mode(hartid, scratch->next_arg1,
|
||||
scratch->next_addr, scratch->next_mode);
|
||||
}
|
||||
@@ -124,6 +122,9 @@ static void __attribute__((noreturn)) init_warmboot(struct sbi_scratch *scratch,
|
||||
if (!sbi_platform_has_hart_hotplug(plat))
|
||||
sbi_hart_wait_for_coldboot(scratch, hartid);
|
||||
|
||||
if (sbi_platform_hart_disabled(plat, hartid))
|
||||
sbi_hart_hang();
|
||||
|
||||
rc = sbi_system_warm_early_init(scratch, hartid);
|
||||
if (rc)
|
||||
sbi_hart_hang();
|
||||
@@ -164,7 +165,11 @@ void __attribute__((noreturn)) sbi_init(struct sbi_scratch *scratch)
|
||||
{
|
||||
bool coldboot = FALSE;
|
||||
u32 hartid = sbi_current_hartid();
|
||||
struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
||||
|
||||
if (sbi_platform_hart_disabled(plat, hartid))
|
||||
sbi_hart_hang();
|
||||
|
||||
if (atomic_add_return(&coldboot_lottery, 1) == 1)
|
||||
coldboot = TRUE;
|
||||
|
||||
|
@@ -28,7 +28,7 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch,
|
||||
|
||||
/* send IPIs to everyone */
|
||||
for (i = 0, m = mask; m; i++, m >>= 1) {
|
||||
if ((m & 1) && (i != hartid)) {
|
||||
if ((m & 1) && (i != hartid) && !sbi_platform_hart_disabled(plat, hartid)) {
|
||||
oth = sbi_hart_id_to_scratch(scratch, i);
|
||||
oth->ipi_type = event;
|
||||
mb();
|
||||
|
@@ -81,6 +81,7 @@ struct sbi_platform platform = {
|
||||
|
||||
.hart_count = PLAT_HART_COUNT,
|
||||
.hart_stack_size = PLAT_HART_STACK_SIZE,
|
||||
.disabled_hart_mask = 0,
|
||||
|
||||
.console_init = k210_console_init,
|
||||
.console_putc = k210_console_putc,
|
||||
|
@@ -104,6 +104,7 @@ struct sbi_platform platform = {
|
||||
.features = SBI_PLATFORM_DEFAULT_FEATURES,
|
||||
.hart_count = PLAT_HART_COUNT,
|
||||
.hart_stack_size = PLAT_HART_STACK_SIZE,
|
||||
.disabled_hart_mask = 0,
|
||||
.pmp_region_count = sifive_u_pmp_region_count,
|
||||
.pmp_region_info = sifive_u_pmp_region_info,
|
||||
.cold_final_init = sifive_u_cold_final_init,
|
||||
|
@@ -105,6 +105,7 @@ struct sbi_platform platform = {
|
||||
.features = SBI_PLATFORM_DEFAULT_FEATURES,
|
||||
.hart_count = PLAT_HART_COUNT,
|
||||
.hart_stack_size = PLAT_HART_STACK_SIZE,
|
||||
.disabled_hart_mask = 0,
|
||||
.pmp_region_count = virt_pmp_region_count,
|
||||
.pmp_region_info = virt_pmp_region_info,
|
||||
.cold_final_init = virt_cold_final_init,
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#define SIFIVE_U_UART1_ADDR 0x10011000
|
||||
#define SIFIVE_UART_BAUDRATE 115200
|
||||
|
||||
#define SIFIVE_U_HARITD_ENABLED 1
|
||||
|
||||
/* PRCI clock related macros */
|
||||
//TODO: Do we need a separate driver for this ?
|
||||
#define SIFIVE_PRCI_BASE_ADDR 0x10000000
|
||||
@@ -122,6 +124,7 @@ struct sbi_platform platform = {
|
||||
.features = SBI_PLATFORM_DEFAULT_FEATURES,
|
||||
.hart_count = PLAT_HART_COUNT,
|
||||
.hart_stack_size = PLAT_HART_STACK_SIZE,
|
||||
.disabled_hart_mask = ~(1 << SIFIVE_U_HARITD_ENABLED),
|
||||
.pmp_region_count = sifive_u_pmp_region_count,
|
||||
.pmp_region_info = sifive_u_pmp_region_info,
|
||||
.cold_final_init = sifive_u_cold_final_init,
|
||||
|
Reference in New Issue
Block a user