Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.16.0)

set(configure_string "")

config_option(
CAmkESVMGuestDMAIommu
CAMKES_VM_GUEST_DMA_IOMMU
"Enable DMA through the IOMMU"
DEFAULT
ON
CAmkESVMGuestDMAIommu CAMKES_VM_GUEST_DMA_IOMMU "Enable DMA through the IOMMU" DEFAULT ON
)

# Create VMM configuration library
Expand All @@ -35,22 +31,10 @@ add_subdirectory(libs/libvirtio camkes-arm-vm/libs/libvirtio)

# Declare connectors with templates.
# We can rely on the naming scheme being consistent to allow for easier declaration.
foreach(
connector
IN
ITEMS
seL4UDPSend
seL4UDPRecv
seL4PicoUDPSend
seL4PicoUDPRecv
seL4MultiSharedData
seL4Sataserver
foreach(connector IN ITEMS seL4UDPSend seL4UDPRecv seL4PicoUDPSend seL4PicoUDPRecv
seL4MultiSharedData seL4Sataserver
)
DeclareCAmkESConnector(
${connector}
FROM
${connector}-from.template.c
TO
${connector}-to.template.c
${connector} FROM ${connector}-from.template.c TO ${connector}-to.template.c
)
endforeach()
20 changes: 10 additions & 10 deletions Findcamkes-arm-vm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
# SPDX-License-Identifier: BSD-2-Clause
#

set(CAMKES_ARM_VM_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE STRING "")
set(CAMKES_ARM_VM_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/arm_vm_helpers.cmake" CACHE STRING "")
set(CAMKES_ARM_VM_DIR
"${CMAKE_CURRENT_LIST_DIR}"
CACHE STRING ""
)
set(CAMKES_ARM_VM_HELPERS_PATH
"${CMAKE_CURRENT_LIST_DIR}/arm_vm_helpers.cmake"
CACHE STRING ""
)
mark_as_advanced(CAMKES_ARM_VM_DIR CAMKES_ARM_VM_HELPERS_PATH)

macro(camkes_arm_vm_import_project)
Expand All @@ -16,10 +22,7 @@ macro(camkes_arm_vm_import_project)
CAmkESAddImportPath(${CAMKES_ARM_VM_DIR}/interfaces camkes-arm-vm/interfaces)
CAmkESAddTemplatesPath(${CAMKES_ARM_VM_DIR}/templates camkes-arm-vm/templates)
DeclareCAmkESConnector(
seL4VMDTBPassthrough
FROM
seL4VMDTBPassthrough-from.template.c
TO
seL4VMDTBPassthrough FROM seL4VMDTBPassthrough-from.template.c TO
seL4VMDTBPassthrough-to.template.c
)

Expand Down Expand Up @@ -47,8 +50,5 @@ endmacro()

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
camkes-arm-vm
DEFAULT_MSG
CAMKES_ARM_VM_DIR
CAMKES_ARM_VM_HELPERS_PATH
camkes-arm-vm DEFAULT_MSG CAMKES_ARM_VM_DIR CAMKES_ARM_VM_HELPERS_PATH
)
21 changes: 13 additions & 8 deletions Findcamkes-vm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
# SPDX-License-Identifier: BSD-2-Clause
#

set(CAMKES_VM_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE STRING "")
set(CAMKES_VM_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/camkes_vm_helpers.cmake" CACHE STRING "")
set(CAMKES_VM_SETTINGS_PATH "${CMAKE_CURRENT_LIST_DIR}/camkes_vm_settings.cmake" CACHE STRING "")
set(CAMKES_VM_DIR
"${CMAKE_CURRENT_LIST_DIR}"
CACHE STRING ""
)
set(CAMKES_VM_HELPERS_PATH
"${CMAKE_CURRENT_LIST_DIR}/camkes_vm_helpers.cmake"
CACHE STRING ""
)
set(CAMKES_VM_SETTINGS_PATH
"${CMAKE_CURRENT_LIST_DIR}/camkes_vm_settings.cmake"
CACHE STRING ""
)
mark_as_advanced(CAMKES_VM_DIR CAMKES_VM_HELPERS_PATH CAMKES_VM_SETTINGS_PATH)

macro(camkes_x86_vm_setup_x86_vm_environment)
Expand All @@ -25,9 +34,5 @@ endmacro()

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
camkes-vm
DEFAULT_MSG
CAMKES_VM_DIR
CAMKES_VM_HELPERS_PATH
CAMKES_VM_SETTINGS_PATH
camkes-vm DEFAULT_MSG CAMKES_VM_DIR CAMKES_VM_HELPERS_PATH CAMKES_VM_SETTINGS_PATH
)
44 changes: 23 additions & 21 deletions arm_vm_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
set(ARM_VM_PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
cmake_minimum_required(VERSION 3.16.0)
set(ARM_VM_PROJECT_DIR
"${CMAKE_CURRENT_LIST_DIR}"
CACHE INTERNAL ""
)

# Function appends a given list of CMake config variables as CAmkES CPP flags
# 'configure_string': The variable to append the CPP flags onto
Expand All @@ -28,21 +31,19 @@ function(AddCamkesCPPFlag configure_string)
endif()
endforeach()
# Update the configure_string value
set(${configure_string} "${${configure_string}}" PARENT_SCOPE)
set(${configure_string}
"${${configure_string}}"
PARENT_SCOPE
)
endfunction(AddCamkesCPPFlag)

function(DeclareCAmkESARMVM init_component)
cmake_parse_arguments(
PARSE_ARGV
1
VM_COMP
""
""
PARSE_ARGV 1 VM_COMP "" ""
"EXTRA_SOURCES;EXTRA_INCLUDES;EXTRA_LIBS;EXTRA_C_FLAGS;EXTRA_LD_FLAGS"
)

set(
vm_src
set(vm_src
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/main.c
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/fdt_manipulation.c
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/crossvm.c
Expand All @@ -55,15 +56,14 @@ function(DeclareCAmkESARMVM init_component)
endif()

if(Tk1DeviceFwd)
list(
APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/tk1/device_fwd.c
list(APPEND vm_src
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/tk1/device_fwd.c
)
endif()

# A module that is expected to exist for each platform but not required.
# It should provide basic device intialisation required for every vm configuratoin
set(
platform_module
set(platform_module
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/${KernelPlatform}/init.c
)
if(EXISTS ${platform_module})
Expand All @@ -76,8 +76,8 @@ function(DeclareCAmkESARMVM init_component)
endif()

if(VmVirtioNetVirtqueue)
list(
APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/virtio_net_virtqueue.c
list(APPEND vm_src
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/virtio_net_virtqueue.c
)
endif()

Expand All @@ -86,17 +86,16 @@ function(DeclareCAmkESARMVM init_component)
endif()

if(KernelPlatformExynos5410)
list(
APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/exynos5410/init.c
list(APPEND vm_src
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/exynos5410/init.c
)
set(vm_plat_include "${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/exynos5410")
elseif(KernelPlatformExynos5422)
set(vm_plat_include "${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/exynos5422")
elseif(KernelPlatformZynqmpUltra96v2)
set(vm_plat_include "${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/ultra96v2")
else()
set(
vm_plat_include
set(vm_plat_include
"${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/${KernelPlatform}"
)
endif()
Expand Down Expand Up @@ -138,7 +137,10 @@ function(DeclareCAmkESARMVM init_component)
seL4VMParameters.template.h
)

if(VmVirtioNetArping OR VmVirtioNetVirtqueue OR VmVirtioConsole)
if(VmVirtioNetArping
OR VmVirtioNetVirtqueue
OR VmVirtioConsole
)
DeclareCAmkESComponent(${init_component} LIBS virtioarm vswitch)
endif()

Expand Down
65 changes: 29 additions & 36 deletions camkes_vm_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.16.0)

set(VM_PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
set(VM_PROJECT_DIR
"${CMAKE_CURRENT_LIST_DIR}"
CACHE INTERNAL ""
)

# Function for declaring a CAmkESVM. This is called for each Init component in the applications
# camkes config.
Expand All @@ -15,11 +18,7 @@ set(VM_PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
# the SOURCES, INCLUDES, LIBS, LD_FLAGS and C_FLAGS arguments.
function(DeclareCAmkESVM init_component)
cmake_parse_arguments(
PARSE_ARGV
1
VM_COMP
""
""
PARSE_ARGV 1 VM_COMP "" ""
"EXTRA_SOURCES;EXTRA_INCLUDES;EXTRA_LIBS;EXTRA_C_FLAGS;EXTRA_LD_FLAGS"
)
# Retrieve sources for Init component
Expand Down Expand Up @@ -133,21 +132,19 @@ function(DefineCAmkESVMFileServer)
foreach(element IN LISTS PARAM_DEPENDS)
foreach(item IN LISTS element)
if(item)
set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY DEPS ${item})
set_property(
TARGET ${FSRV_TARGET}
APPEND
PROPERTY DEPS ${item}
)
endif()
endforeach()
endforeach()

foreach(element IN LISTS PARAM_FILES)
foreach(item IN LISTS element) # [<CPIO_NAME>:]<FILENAME>
if(item)
string(
REGEX
MATCH
"^([^:]+)(:([^:]+))?$"
cpio_item
"${item}"
)
string(REGEX MATCH "^([^:]+)(:([^:]+))?$" cpio_item "${item}")
if(NOT cpio_item)
message(FATAL_ERROR "invalid parameter format: '${item}'")
endif()
Expand Down Expand Up @@ -179,13 +176,7 @@ function(DefineCAmkESVMFileServer)

set(CPIO_FILES "")
foreach(item IN LISTS files) # <CPIO_NAME>:<FILENAME>
string(
REGEX
MATCH
"^([^:]+):([^:]+)$"
cpio_item
"${item}"
)
string(REGEX MATCH "^([^:]+):([^:]+)$" cpio_item "${item}")
if(NOT cpio_item)
message(FATAL_ERROR "invalid CPIO file format: '${item}'")
endif()
Expand All @@ -195,8 +186,7 @@ function(DefineCAmkESVMFileServer)
add_custom_command(
OUTPUT "${CPIO_FILE}"
COMMENT "copy: ${FILE_NAME} -> ${CPIO_FILE}"
COMMAND
${CMAKE_COMMAND} -E copy "${FILE_NAME}" "${CPIO_FILE}"
COMMAND ${CMAKE_COMMAND} -E copy "${FILE_NAME}" "${CPIO_FILE}"
VERBATIM
DEPENDS ${FILE_NAME} ${deps}
)
Expand Down Expand Up @@ -248,12 +238,8 @@ function(DeclareCAmkESVMRootServer camkes_config)
get_absolute_source_or_binary(config_file "${camkes_config}")
# Declare CAmkES root server
DeclareCAmkESRootserver(
${config_file}
CPP_FLAGS
${CAMKES_ROOT_VM_CPP_FLAGS}
CPP_INCLUDES
"${VM_PROJECT_DIR}/components/VM"
${CAMKES_ROOT_VM_CPP_INCLUDES}
${config_file} CPP_FLAGS ${CAMKES_ROOT_VM_CPP_FLAGS} CPP_INCLUDES
"${VM_PROJECT_DIR}/components/VM" ${CAMKES_ROOT_VM_CPP_INCLUDES}
)
endfunction(DeclareCAmkESVMRootServer)

Expand Down Expand Up @@ -306,10 +292,18 @@ function(AddToFileServer filename_pref file_dest)
add_custom_target(${FSRV_TARGET})
endif()

set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY FILES "${filename_pref}:${file_dest}")
set_property(
TARGET ${FSRV_TARGET}
APPEND
PROPERTY FILES "${filename_pref}:${file_dest}"
)

if(PARAM_DEPENDS)
set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY DEPS ${PARAM_DEPENDS})
set_property(
TARGET ${FSRV_TARGET}
APPEND
PROPERTY DEPS ${PARAM_DEPENDS}
)
endif()

endfunction(AddToFileServer)
Expand Down Expand Up @@ -339,12 +333,11 @@ function(DecompressLinuxKernel decompress_target decompressed_kernel_image compr
)
# Create custom target for extraction
add_custom_target(
${decompress_target}
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename}"
${decompress_target} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename}"
)
# Set parameter to tell the caller location of decompressed kernel image
set(
${decompressed_kernel_image} ${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename}
set(${decompressed_kernel_image}
${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename}
PARENT_SCOPE
)
endfunction(DecompressLinuxKernel)
Loading