From: Jack Wang <163wangjack@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Alistair Francis <alistair@alistair23.me>,
Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>,
qemu-arm@nongnu.org, qemu-rust@nongnu.org, caojunze424@gmail.com,
Jack Wang <163wangjack@gmail.com>
Subject: [RFC PATCH v1 0/5] hw/gpio: STM32F1xx GPIO controller in Rust
Date: Sun, 26 Jul 2026 22:51:14 +0800 [thread overview]
Message-ID: <20260726145119.19881-1-163wangjack@gmail.com> (raw)
Hi all,
This RFC adds an STM32F1xx GPIO controller modelled in Rust, following the
existing rust/hw/char/pl011 device as a template. The register logic (CRL/CRH
mode+config decode and the IDR update algorithm) is a direct port of the C
model in hw/gpio/stm32l4x5_gpio.c; the STM32F1xx GPIO block (RM0008) is the
same IP used by the upstream stm32f100_soc.
This series is currently stacked on an out-of-tree STM32F103 SoC and board
that are not yet upstream which is https://github.com/shandianchengzi/qemu
But the commit(the initialize logic and gpio architecture) is both capable
for stm32f100.This is the reason that struct name is stm32f1xx. Patch 3
("hw/arm/stm32f103: instantiate and mapGPIO ports") therefore touches files
that do not exist in mainline and willnot apply cleanly on its own.
I am sending this as an RFC to get feedback onthe Rust device model and
its integration now, before the SoC lands, rather than as an apply-ready series
. Once the SoC is upstream (or if you I
can retarget the device at the existing stm32f100_soc), I will resend a
non-RFC series.
checkpatch reports SPDX warnings on Kconfig/trace-events/Cargo.toml/
meson.build and "MAINTAINERS need updating" on the new files. These are
false positives: matching rust/hw/char/pl011, these file types carry no SPDX
header in-tree, and MAINTAINERS already gains an entry covering rust/hw/gpio/
and the qtest in this series.
Anyway this is my first time to generate rust model build so sorry for some
mistakes. And any help or tip are welcomed
Jack Wang (5):
hw/gpio: add stm32f1xx GPIO device model (Rust)
rust: add hw/gpio crate to the workspace
hw/arm/stm32f103: instantiate and map GPIO ports
tests/qtest: add stm32f103 GPIO test
rust/hw/gpio: add native unit tests
MAINTAINERS | 7 +
hw/arm/Kconfig | 1 +
hw/arm/stm32f103_board.c | 2 +-
hw/arm/stm32f103_soc.c | 54 ++-
hw/gpio/Kconfig | 5 +
hw/gpio/trace-events | 7 +
include/hw/arm/stm32f103_soc.h | 9 +
rust/Cargo.lock | 17 +-
rust/Cargo.toml | 18 +
rust/hw/Kconfig | 1 +
rust/hw/gpio/Cargo.toml | 28 ++
rust/hw/gpio/Kconfig | 2 +
rust/hw/gpio/meson.build | 54 +++
rust/hw/gpio/src/bindings.rs | 19 ++
rust/hw/gpio/src/gpio.rs | 539 ++++++++++++++++++++++++++++++
rust/hw/gpio/src/lib.rs | 3 +
rust/hw/gpio/tests/tests.rs | 191 +++++++++++
rust/hw/meson.build | 1 +
tests/qtest/meson.build | 4 +
tests/qtest/stm32f103_gpio-test.c | 328 ++++++++++++++++++
20 files changed, 1281 insertions(+), 9 deletions(-)
create mode 100644 rust/hw/gpio/Cargo.toml
create mode 100644 rust/hw/gpio/Kconfig
create mode 100644 rust/hw/gpio/meson.build
create mode 100644 rust/hw/gpio/src/bindings.rs
create mode 100644 rust/hw/gpio/src/gpio.rs
create mode 100644 rust/hw/gpio/src/lib.rs
create mode 100644 rust/hw/gpio/tests/tests.rs
create mode 100644 tests/qtest/stm32f103_gpio-test.c
--
2.53.0
next reply other threads:[~2026-07-26 14:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 14:51 Jack Wang [this message]
2026-07-26 14:51 ` [RFC PATCH v1 1/5] hw/gpio: add stm32f1xx GPIO device model (Rust) Jack Wang
2026-08-12 15:03 ` Alistair
2026-07-26 14:51 ` [RFC PATCH v1 2/5] rust: add hw/gpio crate to the workspace Jack Wang
2026-07-26 14:51 ` [RFC PATCH v1 3/5] hw/arm/stm32f103: instantiate and map GPIO ports Jack Wang
2026-07-27 7:48 ` Philippe Mathieu-Daudé
2026-07-26 14:51 ` [RFC PATCH v1 4/5] tests/qtest: add stm32f103 GPIO test Jack Wang
2026-07-26 14:51 ` [RFC PATCH v1 5/5] rust/hw/gpio: add native unit tests Jack Wang
2026-08-12 6:31 ` Jack wang
2026-08-12 13:53 ` [RFC PATCH v1 0/5] hw/gpio: STM32F1xx GPIO controller in Rust Jack wang
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=20260726145119.19881-1-163wangjack@gmail.com \
--to=163wangjack@gmail.com \
--cc=alistair@alistair23.me \
--cc=caojunze424@gmail.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/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