Skip to content

Commit

Permalink
cmake: make MAX_NUM_IRQ calculation arch specific
Browse files Browse the repository at this point in the history
- KernelMaxNumNodes is always defined, it's at lest 1
- check CONFIGURE_NUM_PPI explicitly

Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
axel-h committed Apr 29, 2024
1 parent da68196 commit 979e0ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 9 additions & 5 deletions config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ if(DEFINED CALLED_declare_default_headers)
# calculate the irq cnode size based on MAX_NUM_IRQ
if(KernelArchRiscV)
math(EXPR MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ} + 2")
else()
if(DEFINED KernelMaxNumNodes AND CONFIGURE_NUM_PPI GREATER "0" AND KernelArchARM)
elseif(KernelArchARM)
set(MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ}")
if(DEFINED CONFIGURE_NUM_PPI)
# The PPIs are a part of CONFIGURE_MAX_IRQ, but they are separate
# for each core.
math(
EXPR MAX_NUM_IRQ
"(${KernelMaxNumNodes}-1)*${CONFIGURE_NUM_PPI} + ${CONFIGURE_MAX_IRQ}"
"${MAX_NUM_IRQ} + ((${KernelMaxNumNodes} - 1) * ${CONFIGURE_NUM_PPI})"
)
else()
set(MAX_NUM_IRQ "${CONFIGURE_MAX_IRQ}")
endif()
else()
# Don't make any assumption about other architectures.
message(FATAL_ERROR "unsupported architecture: '${KernelArch}'")
endif()
set(BITS "0")
while(MAX_NUM_IRQ GREATER "0")
Expand Down
11 changes: 11 additions & 0 deletions configs/seL4Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ macro(declare_default_headers)
""
${ARGN}
)

if(KernelArchARM)
if(NOT DEFINED CONFIGURE_NUM_PPI)
set(CONFIGURE_NUM_PPI "32")
endif()
else()
if(DEFINED CONFIGURE_NUM_PPI)
message(FATAL_ERROR "NUM_PPI is currently for ARM only")
endif()
endif()

set(CALLED_declare_default_headers 1)
endmacro()

Expand Down

0 comments on commit 979e0ea

Please sign in to comment.