Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip-odroid] #26

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a7f23e2
vm_arm: remove deprecated config options
Mar 21, 2023
3a1a382
libvirtio: cleanup CMake
Nov 29, 2022
a323872
vm_arm: VM must have RAM
Apr 5, 2023
1afd5ff
vm_arm: inline init_ram module
Mar 20, 2023
60eab85
mention DefineCAmkESVMFileServer() in readme
May 20, 2023
b2072b9
CMake: remove AddToFileServer()
May 5, 2023
65d4f91
CMake: remove DeclareCAmkESVMRootServer()
May 5, 2023
5434ee8
vm_arm: fix printed MAC address
May 18, 2023
1c428d9
trivial: remove whitespaces
May 30, 2023
6ef9e62
libvirtio: improve error message
May 29, 2023
85995a9
libvirtio: improve failure handling
May 30, 2023
122611e
vm_arm: helper function vmm_init_iommu()
Mar 31, 2023
bc73bfc
vm_arm: define vm_create_vcpus()
Jun 2, 2023
14a73fc
vm_arm: no need to escape quotes
Mar 29, 2023
7da0344
vm_arm: cleanup and improve error logs
Apr 13, 2023
943f17e
vm_arm: remove seL4_DebugHalt()
Apr 20, 2023
4b8bbf6
vm_arm: add explicit unreachable statement
Feb 20, 2023
6615c58
vm_arm: add assert
Apr 19, 2023
43c4b3e
vm_arm: formatting
Apr 20, 2023
49ab196
vm_arm: infinite loop with for(;;)
Feb 20, 2023
39cb8a2
Merge patch-axel-6
Jan 31, 2024
a71a1a3
Merge patch-axel-18
Jan 31, 2024
3224b4b
Merge patch-axel-23
Jan 31, 2024
250aa1d
Merge patch-axel-26
Jan 31, 2024
a358877
Merge patch-axel-28a
Jan 31, 2024
7d35164
Merge patch-axel-29
Jan 31, 2024
9877496
virtio_net_virtqueue: fix return type
May 22, 2023
c8d3c04
virtio_net_virtqueue: avoid warning
May 22, 2023
10dbb25
virtio_net_virtqueue: remove unused variables
May 25, 2023
2745ebc
virtio_net_virtqueue: cleanup variable usage
May 25, 2023
1a695d7
virtio_net_virtqueue: add helper variables
May 22, 2023
d6e23b0
Merge patch-axel-36
Jan 31, 2024
fdb0f05
Merge patch-axel-45
Jan 31, 2024
5e700a7
vm_arm: DTB node keeping
Apr 20, 2023
05104ab
dump generated device tree
Apr 3, 2023
062b820
wip vGICv2m@0x08020000
Mar 30, 2023
6c69980
wip virtual UART pl011
Mar 15, 2023
4916121
DEBUG: verbose messages
Apr 20, 2023
99b4753
wip better error handling
Apr 19, 2023
0d007d2
wip odroid-c2 and virtual UART pl011
Apr 3, 2023
5f4aa42
wip Odroid-C2 device tree
Apr 6, 2023
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ To ensure you have the necessary dependencies for building the CAmkES VM project
To build an application with this project we use CMake. This repo provides a series of CMake helper functions (found in `camkes_vm_helpers.cmake`) to assit you with defining your CAmkES VM application. Importing this file into your applications CMake configuration gives you access to the following helper functions:

- `DeclareCAmkESVM(init_component [SOURCES INCLUDES LIBS LD_FLAGS C_FLAGS])`: Function for declaring a CAmkESVM. This is called for each Init component in the defined in the applications `.camkes` file. The user can also pass in extra compilation sources, includes, libs and flags to be compiled with the component through additional arguments (`SOURCES`, `INCLUDES`, `LIBS`, `LD_FLAGS` and `C_FLAGS`)
- `DeclareCAmkESVMRootServer(camkes_config)`: Declares the CAmkESVM root server. This function takes the applications `.camkes` file as an argument (`camkes_config`).
- `AddToFileServer(filename_pref file_dest [DEPENDS])`: Function for adding a file/image to the vm file server. The caller specifies the name of they wish to refer to the image in the FileServer through the `filename_pref` parameter. `file_dest` is the file system location of the image the caller is adding. Additional dependencies to the image can be passed through the optional `DEPENDS` parameter.
- `DefineCAmkESVMFileServer([TYPE <type>] [INSTANCE <name>] [FILES <item>[ <item>[...]] [DEPENDS <dep>[ <dep>[...]])`: Function for explicitly creating a file server with the given files. This takes into account any files that have been added before via calls to `AddToFileServer()`. This is called internally from `DeclareCAmkESVMRootServer()`.
- `DecompressLinuxKernel(decompress_target decompressed_kernel_image compressed_kernel_image [DEPENDS])`: Function for decompressing/extracting a vmlinux file from a given kernel image. The caller specifies a target name (`decompress_target`) for decompressing the kernel, the kernel image to decompress (`compressed_kernel_image`) and additional dependencies to the compressed image through the optional `DEPENDS` parameter. The location of the decompressed image is populated in the `decompressed_kernel_image` parameter passed by the caller.
- `DeclareCAmkESRootserver()`. Declare the the CAmkES Root Server that sets up the system.

## Items

Expand Down
10 changes: 9 additions & 1 deletion arm_vm_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,21 @@ function(DeclareCAmkESARMVM init_component)
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/fdt_manipulation.c
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/crossvm.c
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/map_frame_hack.c
${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/init_ram.c
)

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

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

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


if(Tk1DeviceFwd)
list(
APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/tk1/device_fwd.c
Expand Down
146 changes: 16 additions & 130 deletions camkes_vm_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,21 @@ function(DefineCAmkESVMFileServer)
set(PARAM_INSTANCE "fserv")
endif()

# The target might exist already when AddToFileServer() was called.
set(FSRV_TARGET "vm_fileserver_config_${PARAM_INSTANCE}")
if(NOT TARGET ${FSRV_TARGET})
add_custom_target(${FSRV_TARGET})
endif()

# For dependencies and files, both lists and lists of list are supported for
# convenience reasons. Furthermore, empty entries are also allowed. This
# can happen when the caller uses variables for the lists, when in some
# configurations the lists remain empty.

set(DEPS "")
foreach(element IN LISTS PARAM_DEPENDS)
foreach(item IN LISTS element)
if(item)
set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY DEPS ${item})
list(APPEND DEPS "${item}")
endif()
endforeach()
endforeach()

set(CPIO_FILES "")
foreach(element IN LISTS PARAM_FILES)
foreach(item IN LISTS element) # [<CPIO_NAME>:]<FILENAME>
if(item)
Expand All @@ -158,54 +154,24 @@ function(DefineCAmkESVMFileServer)
set(FILE_NAME "${CMAKE_MATCH_1}")
get_filename_component(CPIO_NAME "${FILE_NAME}" NAME)
endif()
set_property(
TARGET ${FSRV_TARGET}
APPEND
PROPERTY FILES "${CPIO_NAME}:${FILE_NAME}"
set(CPIO_FILE "${PARAM_INSTANCE}/files/${CPIO_NAME}")
add_custom_command(
OUTPUT "${CPIO_FILE}"
COMMENT "copy: ${FILE_NAME} -> ${CPIO_FILE}"
COMMAND
${CMAKE_COMMAND} -E copy "${FILE_NAME}" "${CPIO_FILE}"
VERBATIM
DEPENDS ${FILE_NAME} ${DEPS}
)
# There is no need to create an explicit target for the command
# above, because the archive creation depends on all files
# listed in CPIO_FILES. The command above is the creation rule
# for each one.
list(APPEND CPIO_FILES "${CPIO_FILE}")
endif()
endforeach()
endforeach()

# now process the file/deps list
get_target_property(files ${FSRV_TARGET} FILES)
if(NOT files) # this also catches "files-NOTFOUND" if property is not set
set(files "")
endif()
get_target_property(deps ${FSRV_TARGET} DEPS)
if(NOT deps) # this also catches "deps-NOTFOUND" if property is not set
set(deps "")
endif()

set(CPIO_FILES "")
foreach(item IN LISTS files) # <CPIO_NAME>:<FILENAME>
string(
REGEX
MATCH
"^([^:]+):([^:]+)$"
cpio_item
"${item}"
)
if(NOT cpio_item)
message(FATAL_ERROR "invalid CPIO file format: '${item}'")
endif()
set(CPIO_NAME "${CMAKE_MATCH_1}")
set(FILE_NAME "${CMAKE_MATCH_2}")
set(CPIO_FILE "${PARAM_INSTANCE}/files/${CPIO_NAME}")
add_custom_command(
OUTPUT "${CPIO_FILE}"
COMMENT "copy: ${FILE_NAME} -> ${CPIO_FILE}"
COMMAND
${CMAKE_COMMAND} -E copy "${FILE_NAME}" "${CPIO_FILE}"
VERBATIM
DEPENDS ${FILE_NAME} ${deps}
)
# There is no need to create an explicit target for the command above,
# the archive creation depends on all files in CPIO_FILES, where the
# command above is the creation rule for each one.
list(APPEND CPIO_FILES "${CPIO_FILE}")
endforeach()

# Build CPIO archive. It implicitly depends on all files in CPIO_FILES,
# which have their own dependencies each from above. So we don't have any
# additional explicit dependencies here.
Expand Down Expand Up @@ -234,86 +200,6 @@ function(DefineCAmkESVMFileServer)

endfunction(DefineCAmkESVMFileServer)

# Function for declaring the CAmkESVM root server. Taking the camkes application
# config file we declare a CAmkES Root server and the VM File Server. It is
# expected the caller has declared the file server images before using this
# function.
# camkes_config: The applications .camkes file
# In addition the user can pass in extra CPP compilation includes and flags through
# the CPP_INCLUDES and CPP_FLAGS arguments.
function(DeclareCAmkESVMRootServer camkes_config)
cmake_parse_arguments(PARSE_ARGV 1 CAMKES_ROOT_VM "" "" "CPP_INCLUDES;CPP_FLAGS")
# Initialise the CAmKES VM fileserver
DefineCAmkESVMFileServer()
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}
)
endfunction(DeclareCAmkESVMRootServer)

# Function for adding a file/image to the vm file server.
#
# Parameters:
#
# <filename_pref>
# The name to use for the file in the file server. Components using a file
# server could expect certain files to have a specific name, which could
# differer from the file name on the disk, so this provides a convenient way
# to handle the renaming.
#
# <file_dest>
# The location of the file on the disk.
#
# INSTANCE <name>
# The File server instance to add the file to.
# Optional, defaults to "fserv".
#
# DEPENDS <dep>[ <dep>[...]]
# Additional dependencies of the file added to the file server. This is an
# optional parameter for non-trivial dependencies of the input file. Each file
# server instance depends on all input files anyway, thus a re-build happens
# automatically on any changes. If an input file is created dynamically by
# another regular CMake target, any dependencies should have been specified
# there already, so there is no need to repeat them here.
#
function(AddToFileServer filename_pref file_dest)

cmake_parse_arguments(
PARSE_ARGV
2
PARAM # variable prefix
"" # option arguments
"INSTANCE" # optional single value arguments
"DEPENDS" # optional multi value arguments
)

if(PARAM_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown arguments: ${PARAM_UNPARSED_ARGUMENTS}")
endif()

if(NOT PARAM_INSTANCE)
set(PARAM_INSTANCE "fserv")
endif()

set(FSRV_TARGET "vm_fileserver_config_${PARAM_INSTANCE}")
if(NOT TARGET ${FSRV_TARGET})
add_custom_target(${FSRV_TARGET})
endif()

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})
endif()

endfunction(AddToFileServer)

# Function for decompressing/extracting a vmlinux file from a given kernel image
# decompress_target: The target name the caller wishes to use to generate the decompressed kernel
# image
Expand Down
2 changes: 1 addition & 1 deletion components/Init/src/virtio_con.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void console_handle_irq(void *cookie)
{
virtio_con_cookie_t *virtio_cookie = (virtio_con_cookie_t *)cookie;
if (!virtio_cookie || !virtio_cookie->vm) {
ZF_LOGE("NULL virtio cookie given to raw irq handler");
ZF_LOGE("invalid cookie given to raw irq handler");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion components/Init/src/virtio_vsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static void vsock_inject_irq(void *cookie)
{
virtio_vsock_cookie_t *virtio_cookie = (virtio_vsock_cookie_t *)cookie;
if (!virtio_cookie || !virtio_cookie->vm) {
ZF_LOGE("NULL virtio cookie given to raw irq handler");
ZF_LOGE("invalid cookie given to raw irq handler");
return;
}

Expand Down
16 changes: 0 additions & 16 deletions components/VM_Arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,6 @@ config_option(
OFF
)

config_option(
VmInitRdFile
VM_INITRD_FILE
"Enables the option for the VM to open and load a seperate initrd file"
DEFAULT
OFF
)

config_option(
VmDtbFile
VM_DTB_FILE
"Enables the option for the VM to open and load a seperate dtb file"
DEFAULT
OFF
)

config_option(
VmVirtUart
VM_VIRT_UART
Expand Down
17 changes: 0 additions & 17 deletions components/VM_Arm/configurations/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,6 @@
int clean_cache = false; \
int map_one_to_one = false; \
} vm_image_config; \
attribute { \
string linux_ram_base; \
string linux_ram_paddr_base; \
string linux_ram_size; \
string linux_ram_offset = "0"; /* obsolete */ \
string dtb_addr; \
string initrd_max_size = "-1"; /* obsolete */ \
string initrd_addr; \
} linux_address_config; \
attribute { \
string linux_name = "linux"; \
string dtb_name = "linux-dtb"; \
string initrd_name = "linux-initrd"; \
string linux_bootcmdline = ""; \
string linux_stdout = ""; \
string dtb_base_name = ""; \
} linux_image_config; \
attribute { \
int send_id; \
int recv_id; \
Expand Down
74 changes: 72 additions & 2 deletions components/VM_Arm/plat_include/odroidc2/plat/vmlinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,79 @@
static const int linux_pt_irqs[] = {};

static const int free_plat_interrupts[] = { 50 + IRQ_SPI_OFFSET };
static const char *plat_keep_devices[] = {};
static const char *plat_keep_devices[] = {
"/timer",
"/xtal-clk",
"/arm-pmu",
"/psci",
};
static const char *plat_keep_device_and_disable[] = {};
static const char *plat_keep_device_and_subtree[] = {
GIC_NODE_PATH,
// "/reserved-memory",
"/firmware",
"/efuse",
"/scpi",
// "/soc/sram@c8000000",
// GIC_NODE_PATH,
// "/soc/bus@c1100000/interrupt-controller@9880",
// "/soc/bus@c1100000/reset-controller@4404",
// "/soc/ethernet@c9410000",
"/soc",
//"/soc/bus@c8100000/sys-ctrl@0"

// reserved-memory
// cpus
// arm-pmu {
// psci {
// timer {
// xtal-clk {
// firmware {
// efuse {
// scpi {
// soc {
// sram@c8000000 {
// bus@c8100000 {
// sys-ctrl@0 {
// power-controller-vpu {
// clock-controller {
// cec@100 {
// ao-secure@140 {
// serial@4c0 {
// serial@4e0 {
// i2c@500 {
// pwm@550 {
// ir@580 {
// pinctrl@14 {
// periphs@c8834000 {
// rng {
// pinctrl@4b0 {
// bus@c8838000 {
// video-lut@48 {
// bus@c883c000 {
// system-controller@0 {
// clock-controller {
// mailbox@404 {
// ethernet@c9410000 {
// mdio {
// apb@d0000000 {
// mmc@70000 {
// mmc@72000 {
// mmc@74000 {
// gpu@c0000 {
// vpu@d0100000 {
// hdmi-tx@c883a000 {
// phy@c0000000 {
// phy@c0000020 {
// usb@c9000000 {
// usb@c9100000 {
// memory@0 {
// regulator-usb-pwrs {
// leds {
// regulator-tflash_vdd {
// gpio-regulator-tf_io {
// regulator-vcc1v8 {
// regulator-vcc3v3 {
// emmc-pwrseq {
// hdmi-connector {
};
static const char *plat_keep_device_and_subtree_and_disable[] = {};
Loading
Loading