Skip to content

Commit

Permalink
feat(riscv/aclint): make platform aclint support compile opt
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com>
  • Loading branch information
ninolomata committed Oct 27, 2023
1 parent 768913d commit 3215ccb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/arch/riscv/arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ irqc_arch_dir=$(cpu_arch_dir)/irqc/$(IRQC_DIR)
src_dirs+=$(irqc_arch_dir)

arch-cppflags+=-DIRQC=$(IRQC)
arch-cppflags+=-DIPIC=$(IPIC)
ifeq ($(ACLINT_PRESENT), 1)
arch-cppflags+=-DACLINT_PRESENT
endif
Expand Down
3 changes: 3 additions & 0 deletions src/arch/riscv/inc/arch/interrupts.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#define PLIC (1)
#define APLIC (2)

#define IPIC_SBI (1)
#define IPIC_ACLINT (2)

/**
* In riscv, the ipi (software interrupt) and timer interrupts dont actually
* have an ID as their are treated differently from external interrupts
Expand Down
4 changes: 3 additions & 1 deletion src/arch/riscv/objects.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ cpu-objs-y+=cpu.o
cpu-objs-y+=cache.o
cpu-objs-y+=iommu.o
cpu-objs-y+=relocate.o
cpu-objs-y+=aclint.o
ifeq ($(IPIC),IPIC_ACLINT)
cpu-objs-y+=aclint.o
endif
2 changes: 2 additions & 0 deletions src/platform/qemu-riscv64-virt/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ARCH:=riscv
CPU:=
# Interrupt controller definition
IRQC:=PLIC
# Core IPIs controller
IPIC:=IPIC_ACLINT

drivers := sbi_uart

Expand Down
10 changes: 8 additions & 2 deletions src/platform/qemu-riscv64-virt/virt_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ struct platform platform = {
#else
#error "unknown IRQC type " IRQC
#endif
// Disable ACLINT by default
.aclint_sswi.base = 0

#if (IPIC == IPIC_SBI)
.aclint_sswi.base = 0,
#elif (IPIC == IPIC_ACLINT)
.aclint_sswi.base = 0x2f00000,
#else
#error "unknown IPIC type " IPIC
#endif
}

};

0 comments on commit 3215ccb

Please sign in to comment.