forked from qemu/qemu
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a re-implementation of hw/char/pl011.c in Rust. How to build: 1. Configure a QEMU build with: --enable-system --target-list=aarch64-softmmu --enable-rust 2. Launching a VM with qemu-system-aarch64 should use the Rust version of the pl011 device Co-authored-by: Junjie Mao <[email protected]> Co-authored-by: Paolo Bonzini <[email protected]> Signed-off-by: Junjie Mao <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: Manos Pitsidianakis <[email protected]> Link: https://lore.kernel.org/r/6ec1d4fb8db2a1d7ba94c73e65d9770371b7857d.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini <[email protected]>
- Loading branch information
1 parent
2b74dd9
commit d0f0cd5
Showing
37 changed files
with
1,906 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -1139,6 +1139,11 @@ F: include/hw/*/microbit*.h | |
F: tests/qtest/microbit-test.c | ||
F: docs/system/arm/nrf.rst | ||
|
||
ARM PL011 Rust device | ||
M: Manos Pitsidianakis <[email protected]> | ||
S: Maintained | ||
F: rust/hw/char/pl011/ | ||
|
||
AVR Machines | ||
------------- | ||
|
||
|
This file contains 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 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 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 @@ | ||
source hw/Kconfig |
This file contains 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,2 @@ | ||
# devices Kconfig | ||
source char/Kconfig |
This file contains 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,3 @@ | ||
config X_PL011_RUST | ||
bool | ||
default y if HAVE_RUST |
This file contains 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 @@ | ||
subdir('pl011') |
This file contains 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,2 @@ | ||
# Ignore generated bindings file overrides. | ||
src/bindings.rs.inc |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,26 @@ | ||
[package] | ||
name = "pl011" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Manos Pitsidianakis <[email protected]>"] | ||
license = "GPL-2.0-or-later" | ||
readme = "README.md" | ||
homepage = "https://www.qemu.org" | ||
description = "pl011 device model for QEMU" | ||
repository = "https://gitlab.com/epilys/rust-for-qemu" | ||
resolver = "2" | ||
publish = false | ||
keywords = [] | ||
categories = [] | ||
|
||
[lib] | ||
crate-type = ["staticlib"] | ||
|
||
[dependencies] | ||
bilge = { version = "0.2.0" } | ||
bilge-impl = { version = "0.2.0" } | ||
qemu_api = { path = "../../../qemu-api" } | ||
qemu_api_macros = { path = "../../../qemu-api-macros" } | ||
|
||
# Do not include in any global workspace | ||
[workspace] |
This file contains 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,31 @@ | ||
# PL011 QEMU Device Model | ||
|
||
This library implements a device model for the PrimeCell® UART (PL011) | ||
device in QEMU. | ||
|
||
## Build static lib | ||
|
||
Host build target must be explicitly specified: | ||
|
||
```sh | ||
cargo build --target x86_64-unknown-linux-gnu | ||
``` | ||
|
||
Replace host target triplet if necessary. | ||
|
||
## Generate Rust documentation | ||
|
||
To generate docs for this crate, including private items: | ||
|
||
```sh | ||
cargo doc --no-deps --document-private-items --target x86_64-unknown-linux-gnu | ||
``` | ||
|
||
To include direct dependencies like `bilge` (bitmaps for register types): | ||
|
||
```sh | ||
cargo tree --depth 1 -e normal --prefix none \ | ||
| cut -d' ' -f1 \ | ||
| xargs printf -- '-p %s\n' \ | ||
| xargs cargo doc --no-deps --document-private-items --target x86_64-unknown-linux-gnu | ||
``` |
This file contains 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,26 @@ | ||
subproject('bilge-0.2-rs', required: true) | ||
subproject('bilge-impl-0.2-rs', required: true) | ||
|
||
bilge_dep = dependency('bilge-0.2-rs') | ||
bilge_impl_dep = dependency('bilge-impl-0.2-rs') | ||
|
||
_libpl011_rs = static_library( | ||
'pl011', | ||
files('src/lib.rs'), | ||
override_options: ['rust_std=2021', 'build.rust_std=2021'], | ||
rust_abi: 'rust', | ||
dependencies: [ | ||
bilge_dep, | ||
bilge_impl_dep, | ||
qemu_api, | ||
qemu_api_macros, | ||
], | ||
) | ||
|
||
rust_devices_ss.add(when: 'CONFIG_X_PL011_RUST', if_true: [declare_dependency( | ||
link_whole: [_libpl011_rs], | ||
# Putting proc macro crates in `dependencies` is necessary for Meson to find | ||
# them when compiling the root per-target static rust lib. | ||
dependencies: [bilge_impl_dep, qemu_api_macros], | ||
variables: {'crate': 'pl011'}, | ||
)]) |
Oops, something went wrong.