Manos Pitsidianakis
230b710bf4
rust/pl011: Use correct masks for IBRD and FBRD
...
Port fix from commit cd247eae16
"hw/char/pl011: Use correct masks for IBRD and FBRD"
Related issue: <https://gitlab.com/qemu-project/qemu/-/issues/2610 >
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-9-051e7a25b978@linaro.org
2024-11-05 14:18:16 +01:00
Manos Pitsidianakis
d38723f568
rust/pl011: remove commented out C code
...
This code juxtaposed what should be happening according to the C device
model but is not needed now that this has been reviewed (I hope) and its
validity checked against what the C device does (I hope, again).
No functional change.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-8-051e7a25b978@linaro.org
2024-11-05 14:18:16 +01:00
Manos Pitsidianakis
2e06e72d2e
rust/pl011: add TYPE_PL011_LUMINARY device
...
Add a device specialization for the Luminary UART device.
This commit adds a DeviceId enum that utilizes the Index trait to return
different bytes depending on what device id the UART has (Arm -default-
or Luminary)
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Tested-by: Zhao Liu <zhao1.liu@intel.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-6-051e7a25b978@linaro.org
2024-11-05 14:18:16 +01:00
Manos Pitsidianakis
2e57bb6b27
rust/pl011: move CLK_NAME static to function scope
...
We do not need to have CLK_NAME public nor a static. No functional change.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-5-051e7a25b978@linaro.org
2024-11-05 14:18:16 +01:00
Manos Pitsidianakis
93243319db
rust/pl011: add support for migration
...
Declare the vmstate description of the PL011 device.
Based on a patch by Manos Pitsidianakis
(https://lore.kernel.org/qemu-devel/20241024-rust-round-2-v1-4-051e7a25b978@linaro.org/ ).
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-4-051e7a25b978@linaro.org
2024-11-05 14:18:16 +01:00
Paolo Bonzini
113c668852
rust/pl011: fix default value for migrate-clock
...
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2024-11-05 14:18:16 +01:00
Paolo Bonzini
f60f3670fd
rust: do not use TYPE_CHARDEV unnecessarily
...
In the invocation of qdev_prop_set_chr(), "chardev" is the name of a
property rather than a type and has to match the name of the property
in device_class.rs. Do not use TYPE_CHARDEV here, just like in the C
version of pl011_create.
Reviewed-by: Junjie Mao <junjie.mao@hotmail.com >
Reviewed-by: Kevin Wolf <kwolf@redhat.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2024-11-05 14:18:16 +01:00
Paolo Bonzini
6e50bde1e1
rust: provide safe wrapper for MaybeUninit::zeroed()
...
MaybeUninit::zeroed() is handy, but it introduces unsafe (and has a
pretty heavy syntax in general). Introduce a trait that provides the
same functionality while staying within safe Rust.
In addition, MaybeUninit::zeroed() is not available as a "const"
function until Rust 1.75.0, so this also prepares for having handwritten
implementations of the trait until we can assume that version.
Reviewed-by: Junjie Mao <junjie.mao@hotmail.com >
Reviewed-by: Kevin Wolf <kwolf@redhat.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2024-11-05 14:18:16 +01:00
Paolo Bonzini
2eb6274d12
rust: remove uses of #[no_mangle]
...
Mangled symbols do not cause any issue; disabling mangling is only useful if
C headers reference the Rust function, which is not the case here.
Reviewed-by: Junjie Mao <junjie.mao@hotmail.com >
Reviewed-by: Kevin Wolf <kwolf@redhat.com >
Reviewed-by: Zhao Liu <zhao1.liu@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2024-11-05 14:18:15 +01:00
Paolo Bonzini
b00bf4edee
rust: do not always select X_PL011_RUST
...
Right now the Rust pl011 device is included in all QEMU system
emulator binaries if --enable-rust is passed. This is not needed
since the board logic in hw/arm/Kconfig will pick it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2024-11-05 14:18:15 +01:00
Manos Pitsidianakis
37fdb2f56a
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 <junjie.mao@intel.com >
Co-authored-by: Paolo Bonzini <pbonzini@redhat.com >
Signed-off-by: Junjie Mao <junjie.mao@intel.com >
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-2-051e7a25b978@linaro.org
2024-11-05 14:18:15 +01:00
Manos Pitsidianakis
ca5aa28e24
Revert "rust: add PL011 device model"
...
Patch was applied with invalid authorship by accident, which confuses
git tooling that look at git blame for contributors etc.
Patch will be re-applied with correct authorship right after this
commit.
This reverts commit d0f0cd5b1f
.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Link: https://lore.kernel.org/r/20241024-rust-round-2-v1-1-051e7a25b978@linaro.org
2024-11-05 14:18:15 +01:00
Paolo Bonzini
d0f0cd5b1f
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 <junjie.mao@intel.com >
Co-authored-by: Paolo Bonzini <pbonzini@redhat.com >
Signed-off-by: Junjie Mao <junjie.mao@intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org >
Link: https://lore.kernel.org/r/6ec1d4fb8db2a1d7ba94c73e65d9770371b7857d.1727961605.git.manos.pitsidianakis@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2024-10-11 12:32:17 +02:00