Skip to content

Commit

Permalink
riscv/qemu-rv: add RPTUN support
Browse files Browse the repository at this point in the history
This adds initial RPTUN support for qemu-rv chip.

Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 committed Aug 18, 2024
1 parent a5bf729 commit fa94b48
Show file tree
Hide file tree
Showing 4 changed files with 462 additions and 1 deletion.
4 changes: 4 additions & 0 deletions arch/risc-v/src/qemu-rv/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ endif
ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += qemu_rv_userspace.c
endif

ifeq ($(CONFIG_RPTUN),y)
CHIP_CSRCS += qemu_rv_rptun.c
endif
32 changes: 31 additions & 1 deletion arch/risc-v/src/qemu-rv/qemu_rv_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@
#include "riscv_aia.h"
#include "chip.h"

#ifdef CONFIG_RPTUN
#include "qemu_rv_rptun.h"
#endif

/****************************************************************************
* Private Functions
****************************************************************************/

#ifdef CONFIG_RPTUN
static int qemu_ipi_handler(int mcause, FAR void *regs, FAR void *args)
{
/* Clear IPI (Inter-Processor-Interrupt) */

riscv_ipi_clear(up_cpu_index());

#ifdef CONFIG_SMP
riscv_pause_handler(mcause, regs, args);
#endif

qemu_rptun_ipi();
return OK;
}
#endif

/****************************************************************************
* Public Functions
****************************************************************************/
Expand Down Expand Up @@ -106,7 +130,13 @@ void up_irqinitialize(void)

riscv_exception_attach();

#ifdef CONFIG_SMP
#ifdef CONFIG_RPTUN
/* Replace default IRQ_SOFT handler */

irq_attach(RISCV_IRQ_SOFT, qemu_ipi_handler, NULL);
#endif

#if defined(CONFIG_SMP) || defined(CONFIG_RPTUN)
/* Clear IPI for CPU0 */

riscv_ipi_clear(0);
Expand Down
Loading

0 comments on commit fa94b48

Please sign in to comment.