diff --git a/README.md b/README.md index 7b1901a3..b109acfc 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Currently the supported platforms include: * TX1 * TX2 * QEMU ARM virt machine +* ZCU102 * x86 * x86_64 (coming) @@ -29,7 +30,8 @@ cd build ../init-build.sh -DCAMKES_VM_APP=vm_minimal -DPLATFORM=tk1 ninja ``` -*Note: To buid for another platform you can substitute the value of the `-DPLATFORM` variable e.g. (exynos5422, tx1, tx2, qemu-arm-virt)* +*Note: To buid for another platform you can substitute the value of the `-DPLATFORM` variable +e.g. (exynos5422, tx1, tx2, qemu-arm-virt, zcu102)* *Note: If building for x86 you don't need to specify the `-DPLATFORM` variable* ### For Arm @@ -98,12 +100,13 @@ See the below feature matrix for the various features the CAmkES ARM VMM impleme | TK1 | 32-bit | Unsupported | Unsupported | Unsupported | Unsupported | Unsupported | Unsupported | SMP configurations are unsupported due to: * No TK1 kernel SMP support * No virtual power device interface to manage VCPU's at runtime (e.g. core startup) Virtio PCI, Console, Net, Cross VM connector support & Multi-VM are untested | | TX1 | 64-bit | Supported | Unsupported | Unsupported | Unsupported | Unsupported | Unsupported | Virtio PCI, Console, Net, Cross VM connector support & Multi-VM are untested | | TX2 | 64-bit | Supported | Supported | Supported | Supported | Supported | Unsupported | Cross VM connector support is untested | +| ZCU102 | 64-bit | Supported | Supported | Supported | Supported | Supported | Unsupported | Cross VM connector support is untested | | QEMU Virt | 64-bit | Supported | Unsupported | Supported | Supported | Supported | Supported | Multi-VM support depends on porting the TimeServer to QEMU (See https://github.com/sel4/global-components/tree/master/components/TimeServer) | ## Arm Platform Configuration Notes -### Exynos5422, TX1, TX2, QEMU ARM Virt configuration +### Exynos5422, TX1, TX2, ZCU102, QEMU ARM Virt configuration We provide a pre-built Linux image and Buildroot image for our guest VM's. See the images in the `camkes-vm-images` repository @ https://github.com/sel4/camkes-vm-images When compiling an application for these platforms, the images are sourced from the platforms subdirectory in the `camkes-vm-images` repo. Feel free also to compile your own Linux and Rootfs images, see the README's in each platform subdirectory (within `camkes-vm-images`) for information about our diff --git a/apps/Arm/vm_minimal/CMakeLists.txt b/apps/Arm/vm_minimal/CMakeLists.txt index 2469f648..3ceae3fd 100644 --- a/apps/Arm/vm_minimal/CMakeLists.txt +++ b/apps/Arm/vm_minimal/CMakeLists.txt @@ -10,6 +10,8 @@ project(camkes-arm-tk1-vm C) include(${CAMKES_ARM_VM_HELPERS_PATH}) +set(cpp_includes "${CAMKES_VM_DIR}/components/VM_Arm") + # Create our CPP Flags based on ARM VM config variables if("${KernelARMPlatform}" STREQUAL "tk1") set(cpp_flags "-DKERNELARMPLATFORM_TK1") @@ -128,6 +130,36 @@ elseif("${KernelARMPlatform}" STREQUAL "odroidc2") output_dtb_location ) AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) + +elseif("${KernelARMPlatform}" STREQUAL "zcu102") + + if("${VmZynqmpPetalinuxVersion}" STREQUAL "") + message( + FATAL_ERROR + "VmZynqmpPetalinuxVersion is not set. Please set to include proper VM artifacts" + ) + endif() + + AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/zynqmp/${VmZynqmpPetalinuxVersion}/linux") + AddToFileServer( + "linux-initrd" + "${CAMKES_VM_IMAGES_DIR}/zynqmp/${VmZynqmpPetalinuxVersion}/rootfs-minimal.cpio.gz" + ) + + set(dts_file "${CAMKES_VM_IMAGES_DIR}/zynqmp/${VmZynqmpPetalinuxVersion}/linux.dts") + + add_custom_command( + OUTPUT linux/linux-dtb + COMMAND bash -c "which dtc && dtc -q -I dts -O dtb ${dts_file} > linux/linux-dtb" + VERBATIM + DEPENDS ${dts_file} + ) + + # Create custom target for setting the dtb + add_custom_target(set_dtb DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb") + AddToFileServer("linux-dtb" "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb" DEPENDS set_dtb) + + list(APPEND cpp_includes "${CAMKES_VM_DIR}/components/VM_Arm/plat_include/zynqmp") endif() AddCamkesCPPFlag(cpp_flags CONFIG_VARS VmEmmc2NoDMA VmVUSB Tk1DeviceFwd Tk1Insecure) @@ -137,10 +169,4 @@ DefineCAmkESVMFileServer() CAmkESAddImportPath(${KernelARMPlatform}) # Declare root server -DeclareCAmkESRootserver( - vm_minimal.camkes - CPP_FLAGS - ${cpp_flags} - CPP_INCLUDES - ${CAMKES_VM_DIR}/components/VM_Arm -) +DeclareCAmkESRootserver(vm_minimal.camkes CPP_FLAGS ${cpp_flags} CPP_INCLUDES ${cpp_includes}) diff --git a/apps/Arm/vm_minimal/settings.cmake b/apps/Arm/vm_minimal/settings.cmake index f1afa18d..ff385ada 100644 --- a/apps/Arm/vm_minimal/settings.cmake +++ b/apps/Arm/vm_minimal/settings.cmake @@ -4,7 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # -set(supported "tk1;tx1;tx2;exynos5422;qemu-arm-virt;odroidc2") +set(supported "tk1;tx1;tx2;exynos5422;qemu-arm-virt;odroidc2;zcu102") if(NOT "${PLATFORM}" IN_LIST supported) message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported. Supported: ${supported}") @@ -36,3 +36,8 @@ if(${PLATFORM} STREQUAL "qemu-arm-virt") set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE) set(VmInitRdFile ON CACHE BOOL "" FORCE) endif() +if(${PLATFORM} STREQUAL "zcu102") + set(AARCH64 ON CACHE BOOL "" FORCE) + set(KernelAllowSMCCalls ON CACHE BOOL "" FORCE) + set(VmZynqmpPetalinuxVersion 2021_1 CACHE STRING "" FORCE) +endif() diff --git a/apps/Arm/vm_minimal/zcu102/devices.camkes b/apps/Arm/vm_minimal/zcu102/devices.camkes new file mode 100644 index 00000000..d455239c --- /dev/null +++ b/apps/Arm/vm_minimal/zcu102/devices.camkes @@ -0,0 +1,134 @@ +/* + * Copyright 2023, DornerWorks + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +#define VM_INITRD_MAX_SIZE 0x1900000 //25 MB +#define VM_RAM_BASE 0x10000000 +#define VM_RAM_SIZE 0x10000000 +#define VM_ENTRY_ADDR 0x10080000 +#define VM_RAM_OFFSET 0 +#define VM_DTB_ADDR 0x12000000 +#define VM_INITRD_ADDR 0x13000000 + +assembly { + composition {} + configuration { + + vm0.vm_address_config = { + "ram_base" : VAR_STRINGIZE(VM_RAM_BASE), + "ram_paddr_base" : VAR_STRINGIZE(VM_RAM_BASE), + "ram_size" : VAR_STRINGIZE(VM_RAM_SIZE), + "dtb_addr" : VAR_STRINGIZE(VM_DTB_ADDR), + "initrd_addr" : VAR_STRINGIZE(VM_INITRD_ADDR), + "kernel_entry_addr" : VAR_STRINGIZE(VM_ENTRY_ADDR), + }; + vm0.num_vcpus = 4; + + /* Extra untyped pool to allow for 256MB of RAM */ + vm0.simple_untyped28_pool = 1; + + vm0.vm_image_config = { + "kernel_name" : "linux", + "initrd_name" : "linux-initrd", + "dtb_base_name" : "linux-dtb", + "kernel_bootcmdline" : "console=ttyPS0,115200 root=/dev/ram rw earlycon clk_ignore_unused", + "kernel_stdout" : "serial0:115200n8", + "generate_dtb" : true, + "provide_dtb" : false, + "map_one_to_one" : false, + "provide_initrd": true, + "clean_cache" : false, + }; + + vm0.dtb = dtb([{"path": "/amba/serial@ff000000"} ]); + + vm0.untyped_mmios = ["0xf9060000:12"]; // Interrupt Controller Virtual CPU interface (Virtual Machine view) + + vm0.plat_keep_devices = [ + "/__symbols__", + "/aliases", + "/aux_ref_clk", + "/axi/interrupt-controller@f9010000", + "/dcc", + "/dp_aclk", + "/edac", + "/fclk0", + "/fclk1", + "/fclk2", + "/fclk3", + "/fpga-full", + "/gt_crx_ref_clk", + "/ina226-u15", + "/ina226-u16", + "/ina226-u65", + "/ina226-u74", + "/ina226-u75", + "/ina226-u76", + "/ina226-u77", + "/ina226-u78", + "/ina226-u79", + "/ina226-u80", + "/ina226-u81", + "/ina226-u84", + "/ina226-u85", + "/ina226-u86", + "/ina226-u87", + "/ina226-u88", + "/ina226-u92", + "/ina226-u93", + "/pmu", + "/psci", + "/pss_alt_ref_clk", + "/pss_ref_clk", + "/ref48M", + "/refhdmi", + "/timer", + "/video_clk", + "/axi/serial@ff000000", + ]; + + vm0.plat_keep_devices_and_subtree = [ + "/firmware", + "/gpio-keys", + "/leds", + "/zynqmp_ipi", + ]; + + vm0.allow_smc = true; + vm0.allowed_smc_functions = [ + SMC_PM_GET_API_VERSION, + SMC_PM_REQUEST_NODE, + SMC_PM_RELEASE_NODE, + SMC_PM_SET_REQUIREMENT, + SMC_PM_INIT_FINALIZE, + SMC_PM_FPGA_GET_STATUS, + SMC_PM_RESET_ASSERT, + SMC_PM_RESET_GET_STATUS, + SMC_PM_MMIO_WRITE, + SMC_PM_MMIO_READ, + SMC_PM_GET_CHIPID, + SMC_PM_PINCTRL_REQUEST, + SMC_PM_PINCTRL_RELEASE, + SMC_PM_PINCTRL_SET_FUNCTION, + SMC_PM_PINCTRL_CONFIG_PARAM_GET, + SMC_PM_PINCTRL_CONFIG_PARAM_SET, + SMC_PM_IOCTL, + SMC_PM_QUERY_DATA, + SMC_PM_CLOCK_ENABLE, + SMC_PM_CLOCK_DISABLE, + SMC_PM_CLOCK_GETSTATE, + SMC_PM_CLOCK_SETDIVIDER, + SMC_PM_CLOCK_GETDIVIDER, + SMC_PM_CLOCK_GETPARENT, + SMC_PM_GET_TRUSTZONE_VERSION, + SMC_IPI_MAILBOX_OPEN, + SMC_IPI_MAILBOX_RELEASE, + SMC_IPI_MAILBOX_ENABLE_IRQ + ]; + } +}