From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: "Zhao Liu" <zhao1.liu@intel.com>,
"Daniel P. Berrangé " <berrange@redhat.com>
Cc: "Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Mads Ynddal" <mads@ynddal.dk>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Benné e" <alex.bennee@linaro.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Philippe Mathieu-Daudé " <philmd@linaro.org>,
"Gustavo Romero" <gustavo.romero@linaro.org>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: Re: [RFC PATCH v1 0/6] Implement ARM PL011 in Rust
Date: Tue, 11 Jun 2024 13:41:57 +0300 [thread overview]
Message-ID: <ewwqb.egyl58j8s5u@linaro.org> (raw)
In-Reply-To: <ZmgcrSYHwA0Z8Asq@intel.com>
On Tue, 11 Jun 2024 12:45, Zhao Liu <zhao1.liu@intel.com> wrote:
>On Tue, Jun 11, 2024 at 09:22:44AM +0100, Daniel P. Berrangé wrote:
>> On Mon, Jun 10, 2024 at 09:22:35PM +0300, Manos Pitsidianakis wrote:
>> > Hello everyone,
>> >
>> > This is an early draft of my work on implementing a very simple device,
>> > in this case the ARM PL011 (which in C code resides in hw/char/pl011.c
>> > and is used in hw/arm/virt.c).
>>
>> looking at the diffstat:
>>
>> > .gitignore | 2 +
>> > .gitlab-ci.d/buildtest.yml | 64 ++--
>> > configure | 12 +
>> > hw/arm/virt.c | 2 +-
>> > meson.build | 99 ++++++
>> > meson_options.txt | 4 +
>> > rust/meson.build | 93 ++++++
>> > rust/pl011/.cargo/config.toml | 2 +
>> > rust/pl011/.gitignore | 2 +
>> > rust/pl011/Cargo.lock | 120 +++++++
>> > rust/pl011/Cargo.toml | 26 ++
>> > rust/pl011/README.md | 42 +++
>> > rust/pl011/build.rs | 44 +++
>> > rust/pl011/meson.build | 7 +
>> > rust/pl011/rustfmt.toml | 10 +
>> > rust/pl011/src/definitions.rs | 95 ++++++
>> > rust/pl011/src/device.rs | 531 ++++++++++++++++++++++++++++++
>> > rust/pl011/src/device_class.rs | 95 ++++++
>> > rust/pl011/src/generated.rs | 5 +
>> > rust/pl011/src/lib.rs | 575 +++++++++++++++++++++++++++++++++
>> > rust/pl011/src/memory_ops.rs | 38 +++
>>
>> My thought is that if we're going to start implementing devices
>> or other parts of QEMU, in Rust, then I do not want to see it
>> placed in a completely separate directory sub-tree.
>>
>> In this example, I would expect to have hw/arm/pl011.rs, or hw/arm/pl011/*.rs
>> so that the device is part of the normal Arm hardware directory structure
>> and maintainer assignments.
>
>It has its advantages. Otherwise, as the number of Rust implementations
>grows, the same mirror directory as QEMU will have to be rebuilt again
>in the Rust directory.
Offtopic for this RFC but:
It'd also mean that each crate would have its own subdir in the tree. In
the future free-standing .rs files like in the kernel would be nice to
have.
For those who are not familiar with Cargo, a cargo library is a single
compilation unit. You cannot have interspersed .rs files and compile
with cargo as one does generally. You'd have to generate the rustc
commands for building.
>
>Further, putting C implementations in the same directory, there is again
>the question of why it needs to be duplicated :-) . This topic is
>probably also beyond the scope of this RFC, but it's nice to have a Rust
>example to start with.
pl011 was suggested by Peter as a very simple device to model. The
duplication is not meant to replace the C version for now or at the
foreseeable future. It's more of a reference implementation.
>
>Currently, pl011 exclusively occupies a cargo as a package. In the
>future, will other Rust implementations utilize the workspace mechanism
>to act as a second package in the same cargo? Or will new cargo be created
>again?
What do you mean by "new cargo"? I didn't catch that :(
A workspace would make sense if we have "general" crate libraries that
hardware crates depend on.
>
>Under a unified Rust directory, using a workspace to manage multiple
>packages looks as if it would be easier to maintain. Decentralized to an
>existing directory, they're all separate cargos, and external dependencies
>tend to become fragmented?
Hmm potentially yes, but that's a "what if" scenario. Let's worry about
that bridge when we cross it!
next prev parent reply other threads:[~2024-06-11 10:50 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 18:22 [RFC PATCH v1 0/6] Implement ARM PL011 in Rust Manos Pitsidianakis
2024-06-10 18:22 ` [RFC PATCH v1 1/6] build-sys: Add rust feature option Manos Pitsidianakis
2024-06-10 19:25 ` Stefan Hajnoczi
2024-06-11 14:19 ` Alex Bennée
2024-06-11 17:53 ` Manos Pitsidianakis
2024-06-11 18:25 ` Stefan Hajnoczi
2024-06-12 8:04 ` Daniel P. Berrangé
2024-06-12 8:25 ` Marc-André Lureau
2024-06-10 18:22 ` [RFC PATCH v1 3/6] DO NOT MERGE: add rustdoc build for gitlab pages Manos Pitsidianakis
2024-06-10 18:22 ` [RFC PATCH v1 4/6] DO NOT MERGE: replace TYPE_PL011 with x-pl011-rust in arm virt machine Manos Pitsidianakis
2024-06-10 18:22 ` [RFC PATCH v1 6/6] DO NOT MERGE: update rustdoc gitlab pages gen Manos Pitsidianakis
2024-06-10 19:37 ` [RFC PATCH v1 0/6] Implement ARM PL011 in Rust Pierrick Bouvier
2024-06-10 20:29 ` Manos Pitsidianakis
2024-06-10 21:38 ` Pierrick Bouvier
2024-06-11 5:47 ` Manos Pitsidianakis
2024-06-11 9:21 ` Alex Bennée
2024-06-11 15:32 ` Pierrick Bouvier
2024-06-11 8:02 ` Daniel P. Berrangé
2024-06-11 9:18 ` Alex Bennée
2024-06-11 10:57 ` Daniel P. Berrangé
2024-06-11 10:58 ` Manos Pitsidianakis
2024-06-11 11:09 ` Daniel P. Berrangé
2024-06-11 11:32 ` Manos Pitsidianakis
2024-06-11 12:51 ` Alex Bennée
2024-06-11 12:54 ` Daniel P. Berrangé
2024-06-11 12:45 ` Antonio Caggiano
2024-06-11 12:49 ` Manos Pitsidianakis
2024-06-10 19:59 ` Stefan Hajnoczi
2024-06-10 20:15 ` Manos Pitsidianakis
2024-06-10 20:47 ` Stefan Hajnoczi
2024-06-11 8:42 ` Daniel P. Berrangé
2024-06-11 9:30 ` Alex Bennée
2024-06-11 13:13 ` Paolo Bonzini
2024-06-11 8:11 ` Philippe Mathieu-Daudé
2024-06-11 8:18 ` Daniel P. Berrangé
2024-06-11 9:53 ` Zhao Liu
2024-06-11 10:50 ` Manos Pitsidianakis
2024-06-11 8:22 ` Daniel P. Berrangé
2024-06-11 9:45 ` Zhao Liu
2024-06-11 10:41 ` Manos Pitsidianakis [this message]
2024-06-11 14:32 ` Zhao Liu
2024-06-11 10:40 ` Manos Pitsidianakis
2024-06-11 13:16 ` Paolo Bonzini
2024-06-11 14:11 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ewwqb.egyl58j8s5u@linaro.org \
--to=manos.pitsidianakis@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=gustavo.romero@linaro.org \
--cc=mads@ynddal.dk \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).