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

Move to Microkit 1.4.0 #102

Merged
merged 1 commit into from
Aug 6, 2024
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
27 changes: 12 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
with:
submodules: 'true'
- name: Download Microkit SDK
run: ./ci/acquire_sdk.sh microkit-sdk.zip ${{ secrets.GITHUB_TOKEN }} linux-x86-64
shell: bash
- name: Extract Microkit SDK
run: unzip microkit-sdk.zip && tar -xf microkit-sdk-1.2.6.tar.gz
run: |
wget https://github.com/seL4/microkit/releases/download/1.4.0/microkit-sdk-1.4.0-linux-x86-64.tar.gz
tar xf microkit-sdk-1.4.0-linux-x86-64.tar.gz
- name: Install dependencies (via apt)
# 'expect' is only a dependency for CI testing
run: sudo apt update && sudo apt install -y make clang lld llvm qemu-system-arm device-tree-compiler expect gcc-aarch64-linux-gnu
Expand All @@ -49,7 +48,7 @@ jobs:
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Build and run examples
run: ./ci/examples.sh ${PWD}/microkit-sdk-1.2.6
run: ./ci/examples.sh ${PWD}/microkit-sdk-1.4.0
shell: bash
- name: Upload built system images
uses: actions/upload-artifact@v4
Expand All @@ -65,10 +64,9 @@ jobs:
with:
submodules: 'true'
- name: Download Microkit SDK
run: ./ci/acquire_sdk.sh microkit-sdk.zip ${{ secrets.GITHUB_TOKEN }} macos-x86-64
shell: bash
- name: Extract Microkit SDK
run: unzip microkit-sdk.zip && tar -xf microkit-sdk-1.2.6.tar.gz
run: |
wget https://github.com/seL4/microkit/releases/download/1.4.0/microkit-sdk-1.4.0-macos-x86-64.tar.gz
tar xf microkit-sdk-1.4.0-macos-x86-64.tar.gz
- name: Install dependencies (via Homebrew)
# 'expect' is only a dependency for CI testing
run: |
Expand All @@ -82,7 +80,7 @@ jobs:
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Build and run examples
run: ./ci/examples.sh ${PWD}/microkit-sdk-1.2.6
run: ./ci/examples.sh ${PWD}/microkit-sdk-1.4.0
shell: bash
- name: Upload built system images
uses: actions/upload-artifact@v4
Expand All @@ -97,16 +95,15 @@ jobs:
with:
submodules: 'true'
- name: Download Microkit SDK
run: ./ci/acquire_sdk.sh microkit-sdk.zip ${{ secrets.GITHUB_TOKEN }} linux-x86-64
shell: bash
- name: Extract Microkit SDK
run: unzip microkit-sdk.zip && tar -xf microkit-sdk-1.2.6.tar.gz
run: |
wget https://github.com/seL4/microkit/releases/download/1.4.0/microkit-sdk-1.4.0-linux-x86-64.tar.gz
tar xf microkit-sdk-1.4.0-linux-x86-64.tar.gz
- name: Install Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Build and run examples
run: nix-shell --run "./ci/examples.sh ${PWD}/microkit-sdk-1.2.6"
run: nix-shell --run "./ci/examples.sh ${PWD}/microkit-sdk-1.4.0"
- name: Upload built system images
uses: actions/upload-artifact@v4
with:
Expand Down
47 changes: 4 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,57 +60,18 @@ nix-shell --pure

#### Acquiring the SDK

Finally, you will need an experimental Microkit SDK.
Finally, you will need version 1.4.0 of the Microkit SDK.

* Currently virtualisation support and other patches that libvmm requires are
not part of mainline Microkit.
* Upstreaming the required changes is in-progress.

For acquiring the SDK, you have two options.

1. Download a pre-built SDK (recommended).
2. Build the SDK yourself.

##### Option 1 - Download pre-built SDK

On Linux (x86-64):
```sh
wget https://trustworthy.systems/Downloads/microkit/microkit-sdk-dev-7c679ea-linux-x86-64.tar.gz
tar xf microkit-sdk-dev-7c679ea-linux-x86-64.tar.gz
```

On macOS (Apple Silicon/AArch64):
```sh
wget https://trustworthy.systems/Downloads/microkit/microkit-sdk-dev-7c679ea-macos-aarch64.tar.gz
tar xf microkit-sdk-dev-7c679ea-macos-aarch64.tar.gz
```

On macOS (Intel/x86-64):
```sh
wget https://trustworthy.systems/Downloads/microkit/microkit-sdk-dev-7c679ea-macos-x86-64.tar.gz
tar xf microkit-sdk-dev-7c679ea-macos-x86-64.tar.gz
```

##### Option 2 - Building the SDK

You will need a development version of the Microkit SDK source code. You can acquire it with the following command:
```sh
git clone https://github.com/Ivan-Velickovic/microkit.git --branch dev
```

From here, you can follow the instructions
[here](https://github.com/Ivan-Velickovic/microkit/tree/dev) to build the SDK.

If you have built the SDK then the path to the SDK should look something like
this: `microkit/release/microkit-sdk-<VERSION>`.
You can download a prebuilt SDK from [here](https://github.com/seL4/microkit/releases/tag/1.4.0)
or [build from source](https://github.com/seL4/microkit)

### Building and running

Finally, we can simulate a basic system with a single Linux guest with the
following command:
```sh
cd examples/simple
make BOARD=qemu_arm_virt MICROKIT_SDK=/path/to/sdk qemu
make BOARD=qemu_virt_aarch64 MICROKIT_SDK=/path/to/sdk qemu
```

You should see Linux booting and be greeted with the buildroot prompt:
Expand Down
40 changes: 20 additions & 20 deletions ci/examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build_simple_zig() {
build_rust() {
echo "CI|INFO: building Rust example with config: $1"
CONFIG=$1
BUILD_DIR="${PWD}/build/examples/rust/qemu_arm_virt/${CONFIG}"
BUILD_DIR="${PWD}/build/examples/rust/qemu_virt_aarch64/${CONFIG}"
mkdir -p ${BUILD_DIR}
make -C examples/rust -B \
BUILD_DIR=${BUILD_DIR} \
Expand All @@ -50,7 +50,7 @@ build_zig() {
echo "CI|INFO: building Zig example with config: $1, Zig optimize is: $2"
CONFIG=$1
ZIG_OPTIMIZE=$2
BUILD_DIR="${PWD}/build/examples/zig/qemu_arm_virt/${CONFIG}/${ZIG_OPTIMIZE}"
BUILD_DIR="${PWD}/build/examples/zig/qemu_virt_aarch64/${CONFIG}/${ZIG_OPTIMIZE}"
EXAMPLE_DIR="${PWD}/examples/zig"
mkdir -p ${BUILD_DIR}
pushd ${EXAMPLE_DIR}
Expand All @@ -64,7 +64,7 @@ build_zig() {

simulate_rust() {
echo "CI|INFO: simulating Rust example with config: $1"
BUILD_DIR="${PWD}/build/examples/rust/qemu_arm_virt/${CONFIG}"
BUILD_DIR="${PWD}/build/examples/rust/qemu_virt_aarch64/${CONFIG}"
./ci/buildroot_login.exp ${BUILD_DIR}/loader.img
}

Expand Down Expand Up @@ -99,20 +99,20 @@ build_virtio() {

simulate_zig() {
echo "CI|INFO: simulating Zig example with config: $1"
BUILD_DIR="${PWD}/build/examples/zig/qemu_arm_virt/${CONFIG}/${ZIG_OPTIMIZE}"
BUILD_DIR="${PWD}/build/examples/zig/qemu_virt_aarch64/${CONFIG}/${ZIG_OPTIMIZE}"
./ci/buildroot_login.exp ${BUILD_DIR}/bin/loader.img
}

build_simple_make "qemu_arm_virt" "debug"
simulate_simple_make "qemu_arm_virt" "debug"
build_simple_make "qemu_arm_virt" "release"
simulate_simple_make "qemu_arm_virt" "release"
build_simple_make "qemu_virt_aarch64" "debug"
simulate_simple_make "qemu_virt_aarch64" "debug"
build_simple_make "qemu_virt_aarch64" "release"
simulate_simple_make "qemu_virt_aarch64" "release"

# @ivanv: we should incorporate the zig optimisation levels as well
build_simple_zig "qemu_arm_virt" "debug"
simulate_simple_zig "qemu_arm_virt" "debug"
build_simple_zig "qemu_arm_virt" "release"
simulate_simple_zig "qemu_arm_virt" "release"
build_simple_zig "qemu_virt_aarch64" "debug"
simulate_simple_zig "qemu_virt_aarch64" "debug"
build_simple_zig "qemu_virt_aarch64" "release"
simulate_simple_zig "qemu_virt_aarch64" "release"

build_simple_make "odroidc4" "debug"
build_simple_make "odroidc4" "release"
Expand All @@ -128,8 +128,8 @@ build_simple_zig "maaxboard" "release"

build_rust "debug"
simulate_rust "debug"
build_rust "release"
simulate_rust "release"
# build_rust "release"
# simulate_rust "release"

# Here there are two kinds of configuration that we need to test. There is the
# configuration of Microkit itself for which we test debug and release. This
Expand All @@ -149,14 +149,14 @@ simulate_zig "release" "ReleaseSmall"

# The setup for virtIO block does not currently work on macOS due to
# Linux-specific utilities not being available.
if [ "$(uname)" == "Linux" ]; then
# if [ "$(uname)" == "Linux" ]; then

build_virtio "qemu_arm_virt" "debug"
build_virtio "qemu_arm_virt" "release"
build_virtio "odroidc4" "debug"
build_virtio "odroidc4" "release"
# build_virtio "qemu_virt_aarch64" "debug"
# build_virtio "qemu_virt_aarch64" "release"
# build_virtio "odroidc4" "debug"
# build_virtio "odroidc4" "release"

fi
# fi

echo ""
echo "CI|INFO: Passed all VMM tests"
2 changes: 1 addition & 1 deletion dep/sddf
Submodule sddf updated 43 files
+8 −10 .github/workflows/examples.yaml
+4 −23 README.md
+3 −1 benchmark/benchmark.c
+9 −5 blk/components/virt.c
+3 −3 ci/examples.sh
+1 −1 drivers/clock/arm/timer.c
+1 −1 drivers/clock/imx/timer.c
+1 −1 drivers/clock/meson/timer.c
+1 −1 drivers/network/imx/ethernet.c
+1 −1 drivers/network/meson/ethernet.c
+1 −1 drivers/network/virtio/ethernet.c
+1 −1 drivers/serial/arm/uart.c
+1 −1 drivers/serial/imx/uart.c
+1 −1 drivers/serial/meson/uart.c
+1 −1 examples/echo_server/Makefile
+4 −4 examples/echo_server/board/imx8mm_evk/echo_server.system
+4 −4 examples/echo_server/board/maaxboard/echo_server.system
+4 −4 examples/echo_server/board/odroidc4/echo_server.system
+4 −4 examples/echo_server/board/qemu_virt_aarch64/echo_server.system
+8 −2 examples/echo_server/include/serial_config/serial_config.h
+12 −12 examples/echo_server/lwip.c
+3 −0 examples/i2c/client.h
+4 −4 examples/serial/README.md
+3 −3 examples/serial/board/imx8mm_evk/serial.system
+3 −3 examples/serial/board/maaxboard/serial.system
+3 −3 examples/serial/board/odroidc4/serial.system
+3 −3 examples/serial/board/qemu_virt_aarch64/serial.system
+4 −4 examples/serial/build.zig
+8 −2 examples/serial/include/serial_config/serial_config.h
+1 −1 examples/serial/serial.mk
+1 −1 examples/timer/Makefile
+4 −4 examples/timer/README.md
+0 −0 examples/timer/board/qemu_virt_aarch64/timer.system
+4 −4 examples/timer/build.zig
+1 −1 i2c/components/virt.c
+2 −0 include/sddf/i2c/client.h
+1 −1 network/components/arp.c
+1 −1 network/components/copy.c
+2 −2 network/components/virt_rx.c
+1 −1 network/components/virt_tx.c
+2 −2 serial/components/virt_tx.c
+3 −1 sound/components/virt.c
+2 −2 util/cache.c
8 changes: 4 additions & 4 deletions docs/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ If your desired platform is not supported by any examples, please see the sectio

The goal of this section is to give a detailed introduction into making a
system using libvmm with the [seL4 Microkit](https://github.com/seL4/microkit).
This is done by explaining one of the example QEMU ARM virt systems that boots
This is done by explaining one of the example QEMU virt AArch64 systems that boots
up a simple Linux guest.

All the existing systems are located in `board/$BOARD/systems/`. This is
Expand All @@ -63,7 +63,7 @@ The first step before writing code is to have a system description that contains
a virtual machine and the VMM protection domain (PD).

The following is essentially what is in
[the QEMU example system](../board/qemu_arm_virt/systems/simple.system),
[the QEMU example system](../board/qemu_virt_aarch64/systems/simple.system),

```xml
<memory_region name="guest_ram" size="0x10_000_000" />
Expand Down Expand Up @@ -346,7 +346,7 @@ There are three files that need to be changed:
* `src/vmm.h`
* `src/vgic/vgic.h`
* For Linux, the device tree needs to contain the location of the initial RAM disk,
see the `chosen` node of `board/qemu_arm_virt/images/linux.dts` as an example.
see the `chosen` node of `board/qemu_virt_aarch64/images/linux.dts` as an example.

As you can probably tell, all this information that needs to be added is known at
build-time, the plan is to auto-generate these values that the VMM needs to make it
Expand Down Expand Up @@ -382,7 +382,7 @@ Assuming the guest is being passed a device tree and initialising devices
based on the device tree passed, it is quite simple to disable the device.

Here is an example of how you would change the Device Tree Source to
disable the PL011 UART node for the QEMU ARM virt platform:
disable the PL011 UART node for the QEMU virt AArch64 platform:
```diff
pl011@9000000 {
clock-names = "uartclk\0apb_pclk";
Expand Down
Loading
Loading