From 764a6ee9feb428a9759eaa94673285fad2586f11 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 3 Oct 2024 16:28:44 +0300 Subject: build-sys: Add rust feature option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add rust feature in meson.build, configure, to prepare for adding Rust code in the followup commits. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Bennée Link: https://lore.kernel.org/r/14642d80fbccbc60f7aa78b449a7deb5e2784ed9.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index 72359066d3..fb3188c053 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4188,6 +4188,11 @@ F: docs/sphinx/ F: docs/_templates/ F: docs/devel/docs.rst +Rust build system integration +M: Manos Pitsidianakis +S: Maintained +F: rust/Kconfig + Miscellaneous ------------- Performance Tools and Tests -- cgit v1.2.3 From 6fdc5bc173188f5e4942616b16d589500b874a15 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 3 Oct 2024 16:28:46 +0300 Subject: rust: add bindgen step as a meson dependency Add bindings_rs target for generating rust bindings to target-independent qemu C APIs. The bindings need be created before any rust crate that uses them is compiled. The bindings.rs file will end up in BUILDDIR/bindings.rs and have the same name as a target: ninja bindings.rs Signed-off-by: Paolo Bonzini Signed-off-by: Manos Pitsidianakis Link: https://lore.kernel.org/r/1be89a27719049b7203eaf2eca8bbb75b33f18d4.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini --- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index fb3188c053..f09029560b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4191,7 +4191,11 @@ F: docs/devel/docs.rst Rust build system integration M: Manos Pitsidianakis S: Maintained +F: scripts/rust/ +F: rust/.gitignore F: rust/Kconfig +F: rust/meson.build +F: rust/wrapper.h Miscellaneous ------------- -- cgit v1.2.3 From 5a5110d290c0f2dca3d98c608b0ec9a01d2181b9 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 3 Oct 2024 16:28:49 +0300 Subject: rust: add crate to expose bindings and interfaces Add rust/qemu-api, which exposes rust-bindgen generated FFI bindings and provides some declaration macros for symbols visible to the rest of QEMU. Co-authored-by: Junjie Mao Co-authored-by: Paolo Bonzini Signed-off-by: Junjie Mao Signed-off-by: Paolo Bonzini Signed-off-by: Manos Pitsidianakis Link: https://lore.kernel.org/r/0fb23fbe211761b263aacec03deaf85c0cc39995.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index f09029560b..de583a1691 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3291,6 +3291,12 @@ F: hw/core/register.c F: include/hw/register.h F: include/hw/registerfields.h +Rust +M: Manos Pitsidianakis +S: Maintained +F: rust/qemu-api +F: rust/rustfmt.toml + SLIRP M: Samuel Thibault S: Maintained -- cgit v1.2.3 From 2b74dd918007d91f5fee94ad0034b5e7a30ed777 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 3 Oct 2024 16:28:50 +0300 Subject: rust: add utility procedural macro crate This commit adds a helper crate library, qemu-api-macros for derive (and other procedural) macros to be used along qemu-api. It needs to be a separate library because in Rust, procedural macros, or macros that can generate arbitrary code, need to be special separate compilation units. Only one macro is introduced in this patch, #[derive(Object)]. It generates a constructor to register a QOM TypeInfo on init and it must be used on types that implement qemu_api::definitions::ObjectImpl trait. Reviewed-by: Junjie Mao Signed-off-by: Manos Pitsidianakis Link: https://lore.kernel.org/r/dd645642406a6dc2060c6f3f17db2bc77ed67b59.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index de583a1691..dbc56c5c61 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3295,6 +3295,7 @@ Rust M: Manos Pitsidianakis S: Maintained F: rust/qemu-api +F: rust/qemu-api-macros F: rust/rustfmt.toml SLIRP -- cgit v1.2.3 From d0f0cd5b1f7e9780753344548e17ad4df9fcf5d8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 10 Oct 2024 16:11:28 +0200 Subject: rust: add PL011 device model 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 Co-authored-by: Paolo Bonzini Signed-off-by: Junjie Mao Signed-off-by: Paolo Bonzini Signed-off-by: Manos Pitsidianakis Link: https://lore.kernel.org/r/6ec1d4fb8db2a1d7ba94c73e65d9770371b7857d.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index dbc56c5c61..539d59c195 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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 +S: Maintained +F: rust/hw/char/pl011/ + AVR Machines ------------- -- cgit v1.2.3