-
Notifications
You must be signed in to change notification settings - Fork 45
Unbitrot vmm LionsOS example #109
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
Open
wom-bat
wants to merge
5
commits into
main
Choose a base branch
from
fix-vmm-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b1e685
Unbitrot vmm LionsOS example
wom-bat 4314159
Add virtio variant of vmm example to CI
wom-bat 782d56b
Add more gnerated files to .gitignore
wom-bat beb5604
Summary: Update to tip of sDDF tree
wom-bat b297ba3
Update README.md to point to lionsos docs site.
wom-bat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| build/ | ||
| docs/book/ | ||
| .DS_Store | ||
|
|
||
| TAGS | ||
| examples/vmm/vmm/initrd.img | ||
| examples/vmm/vmm/linux | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/sh | ||
| # | ||
| # This script aims to build an already checked out version of LionsOS. | ||
| # | ||
|
|
||
| set -e | ||
|
|
||
| if [ "$#" -ne 2 ]; then | ||
| echo "usage: vmm.sh /path/to/lionsos /path/to/microkit/sdk" | ||
| exit 1 | ||
| fi | ||
|
|
||
| LIONSOS=$1 | ||
| MICROKIT_SDK=$2 | ||
|
|
||
| BUILD_DIR=$LIONSOS/ci_build/vmm-virtio | ||
| rm -rf $BUILD_DIR | ||
|
|
||
| export BUILD_DIR=$BUILD_DIR | ||
| export MICROKIT_SDK=$MICROKIT_SDK | ||
| export LIONSOS=$LIONSOS | ||
|
|
||
| cd $LIONSOS/examples/vmm | ||
| make VARIANT=virtio |
Submodule sddf
updated
5 files
| +9 −3 | blk/components/virt.c | |
| +1 −1 | drivers/blk/virtio/block.c | |
| +1 −1 | drivers/serial/meson/uart_driver.mk | |
| +5 −1 | include/sddf/blk/queue.h | |
| +1 −1 | serial/components/serial_components.mk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| VMM Examples | ||
| ================ | ||
|
|
||
| See https://lionsos.org/docs/examples/vmm/ for documentation and build | ||
| instructions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /* | ||
| * Copyright 2024, UNSW | ||
| * | ||
| * SPDX-License-Identifier: BSD-2-Clause | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <microkit.h> | ||
| #include <sddf/util/string.h> | ||
| #include <sddf/serial/queue.h> | ||
| #include <stdint.h> | ||
|
|
||
| /* Number of clients */ | ||
| #define SERIAL_NUM_CLIENTS 1 | ||
|
|
||
| /* Only support transmission and not receive. */ | ||
| #define SERIAL_TX_ONLY 0 | ||
|
|
||
| /* Associate a colour with each client's output. */ | ||
| #define SERIAL_WITH_COLOUR 0 | ||
|
|
||
| /* | ||
| * Control character to switch input stream - ctrl \. | ||
| * To input character input twice. | ||
| */ | ||
| #define SERIAL_SWITCH_CHAR 28 | ||
|
|
||
| /* Control character to terminate client number input. */ | ||
| #define SERIAL_TERMINATE_NUM '\r' | ||
|
|
||
| /* Default baud rate of the uart device */ | ||
| #define UART_DEFAULT_BAUD 115200 | ||
|
|
||
| /* String to be printed to start console input */ | ||
| #define SERIAL_CONSOLE_BEGIN_STRING "Begin input\n" | ||
| #define SERIAL_CONSOLE_BEGIN_STRING_LEN 13 | ||
|
|
||
| #define SERIAL_CLI0_NAME "CLIENT_VM" | ||
| #define SERIAL_VIRT_RX_NAME "serial_virt_rx" | ||
| #define SERIAL_VIRT_TX_NAME "serial_virt_tx" | ||
| #define SERIAL_DRIVER_NAME "uart_driver" | ||
|
|
||
| #define SERIAL_QUEUE_SIZE 0x1000 | ||
| #define SERIAL_DATA_REGION_SIZE 0x2000 | ||
|
|
||
| #define SERIAL_TX_DATA_REGION_SIZE_DRIV SERIAL_DATA_REGION_SIZE | ||
| #define SERIAL_TX_DATA_REGION_SIZE_CLI0 SERIAL_DATA_REGION_SIZE | ||
|
|
||
| #define SERIAL_RX_DATA_REGION_SIZE_DRIV SERIAL_DATA_REGION_SIZE | ||
| #define SERIAL_RX_DATA_REGION_SIZE_CLI0 SERIAL_DATA_REGION_SIZE | ||
|
|
||
| #define SERIAL_MAX_TX_DATA_SIZE MAX( \ | ||
| SERIAL_TX_DATA_REGION_SIZE_DRIV, \ | ||
| SERIAL_TX_DATA_REGION_SIZE_CLI0 \ | ||
| ) | ||
| #define SERIAL_MAX_RX_DATA_SIZE MAX( \ | ||
| SERIAL_RX_DATA_REGION_SIZE_DRIV, \ | ||
| SERIAL_RX_DATA_REGION_SIZE_CLI0 \ | ||
| ) | ||
| #define SERIAL_MAX_DATA_SIZE MAX( \ | ||
| SERIAL_MAX_TX_DATA_SIZE, \ | ||
| SERIAL_MAX_RX_DATA_SIZE \ | ||
| ) | ||
| _Static_assert(SERIAL_MAX_DATA_SIZE < UINT32_MAX, | ||
| "Data regions must be smaller than UINT32 max" | ||
| " to use the queue data structure correctly."); | ||
|
|
||
| static inline void serial_cli_queue_init_sys( | ||
| char *pd_name, serial_queue_handle_t *rx_queue_handle, | ||
| serial_queue_t *rx_queue, char *rx_data, | ||
| serial_queue_handle_t *tx_queue_handle, | ||
| serial_queue_t *tx_queue, char *tx_data) | ||
| { | ||
| if (!sddf_strcmp(pd_name, SERIAL_CLI0_NAME)) { | ||
| serial_queue_init(rx_queue_handle, rx_queue, SERIAL_RX_DATA_REGION_SIZE_CLI0, rx_data); | ||
| serial_queue_init(tx_queue_handle, tx_queue, SERIAL_TX_DATA_REGION_SIZE_CLI0, tx_data); | ||
| } | ||
| } | ||
|
|
||
| static inline void serial_virt_queue_init_sys( | ||
| char *pd_name, serial_queue_handle_t *cli_queue_handle, | ||
| serial_queue_t *cli_queue, char *cli_data) | ||
| { | ||
| if (!sddf_strcmp(pd_name, SERIAL_VIRT_RX_NAME)) { | ||
| serial_queue_init(cli_queue_handle, | ||
| cli_queue, | ||
| SERIAL_RX_DATA_REGION_SIZE_CLI0, | ||
| cli_data); | ||
| } else if (!sddf_strcmp(pd_name, SERIAL_VIRT_TX_NAME)) { | ||
| serial_queue_init(cli_queue_handle, | ||
| cli_queue, | ||
| SERIAL_TX_DATA_REGION_SIZE_CLI0, | ||
| cli_data); | ||
| } | ||
| } | ||
|
|
||
| #if SERIAL_WITH_COLOUR | ||
| static inline void serial_channel_names_init(char **client_names) | ||
| { | ||
| client_names[0] = SERIAL_CLI0_NAME; | ||
| } | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary.