diff options
author | Tom Rini <trini@konsulko.com> | 2020-09-30 09:21:43 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-09-30 09:21:43 -0400 |
commit | 01114adfc1e0bf3cf5e2f3da858bb2c8e9810c1c (patch) | |
tree | 64ab9c9d1c2a5f3cc96b4c0fef1990cb73c1b356 /arch/riscv/lib/smp.c | |
parent | 527fad0b2484bf1dd4c443c4c8f4384aa256938f (diff) | |
parent | 924de3216e9efdf1cdc71b8632099213aac03f2c (diff) |
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into next
- Disable CMD_IRQ for RISC-V.
- Update sipeed/maix doc
- Obtain reg of SiFive RAM via dev_read_addr_index() instead of regmap API.
- Cleans up RISC-V timer drivers and converts them to DM.
- Correctly handle IPIs already pending upon prior stage bootloader (on the K210)
Diffstat (limited to 'arch/riscv/lib/smp.c')
-rw-r--r-- | arch/riscv/lib/smp.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/riscv/lib/smp.c b/arch/riscv/lib/smp.c index ac22136314f..8f33ce1fe36 100644 --- a/arch/riscv/lib/smp.c +++ b/arch/riscv/lib/smp.c @@ -54,6 +54,14 @@ static int send_ipi_many(struct ipi_data *ipi, int wait) gd->arch.ipi[reg].arg0 = ipi->arg0; gd->arch.ipi[reg].arg1 = ipi->arg1; + /* + * Ensure valid only becomes set when the IPI parameters are + * set. An IPI may already be pending on other harts, so we + * need a way to signal that the IPI device has been + * initialized, and that it is ok to call the function. + */ + __smp_store_release(&gd->arch.ipi[reg].valid, 1); + ret = riscv_send_ipi(reg); if (ret) { pr_err("Cannot send IPI to hart %d\n", reg); @@ -81,7 +89,13 @@ void handle_ipi(ulong hart) if (hart >= CONFIG_NR_CPUS) return; - __smp_mb(); + /* + * If valid is not set, then U-Boot has not requested the IPI. The + * IPI device may not be initialized, so all we can do is wait for + * U-Boot to initialize it and send an IPI + */ + if (!__smp_load_acquire(&gd->arch.ipi[hart].valid)) + return; smp_function = (void (*)(ulong, ulong, ulong))gd->arch.ipi[hart].addr; invalidate_icache_all(); |