#
ab810022 |
| 15-Jun-2025 |
Bernhard Beschow <shentey@gmail.com> |
rust/qemu-api: Add initial logging support based on C API
A log_mask_ln!() macro is provided which expects similar arguments as the C version. However, the formatting works as one would expect from
rust/qemu-api: Add initial logging support based on C API
A log_mask_ln!() macro is provided which expects similar arguments as the C version. However, the formatting works as one would expect from Rust.
To maximize code reuse the macro is just a thin wrapper around qemu_log(). Also, just the bare minimum of logging masks is provided which should suffice for the current use case of Rust in QEMU.
Signed-off-by: Bernhard Beschow <shentey@gmail.com> Link: https://lore.kernel.org/r/20250615112037.11992-2-shentey@gmail.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
1ae4ca04 |
| 13-Jun-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: move rust.bindgen to qemu-api crate
Once qemu-api is split in multiple crates, each of them will have its own invocation of bindgen. There cannot be only one, because there are occasional "im
rust: move rust.bindgen to qemu-api crate
Once qemu-api is split in multiple crates, each of them will have its own invocation of bindgen. There cannot be only one, because there are occasional "impl" blocks for the bindgen-generated structs (e.g. VMStateFlags or QOM classes) that have to reside in the same crate as the bindgen-generated code.
For now, prepare for this new organization by invoking bindgen within the qemu-api crate's build definitions; it's also a much better place to list enums that need specific treatment from bindgen.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
8714d366 |
| 23-May-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
util/error: expose Error definition to Rust code
This is used to preserve the file and line in a roundtrip from C Error to Rust and back to C.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
dfc56946 |
| 12-Mar-2025 |
Richard Henderson <richard.henderson@linaro.org> |
include/system: Move exec/address-spaces.h to system/address-spaces.h
Convert the existing includes with sed.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <
include/system: Move exec/address-spaces.h to system/address-spaces.h
Convert the existing includes with sed.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
#
8be545ba |
| 12-Mar-2025 |
Richard Henderson <richard.henderson@linaro.org> |
include/system: Move exec/memory.h to system/memory.h
Convert the existing includes with
sed -i ,exec/memory.h,system/memory.h,g
Move the include within cpu-all.h into a !CONFIG_USER_ONLY block.
include/system: Move exec/memory.h to system/memory.h
Convert the existing includes with
sed -i ,exec/memory.h,system/memory.h,g
Move the include within cpu-all.h into a !CONFIG_USER_ONLY block.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
#
cc3d262a |
| 21-Mar-2025 |
Peter Maydell <peter.maydell@linaro.org> |
rust: pl011: Check size of state struct at compile time
The PL011 device's C implementation exposes its PL011State struct to users of the device, and one common usage pattern is to embed that struct
rust: pl011: Check size of state struct at compile time
The PL011 device's C implementation exposes its PL011State struct to users of the device, and one common usage pattern is to embed that struct into the user's own state struct. (The internals of the struct are technically visible to the C user of the device, but in practice are treated as implementation details.)
This means that the Rust version of the state struct must not be larger than the C version's struct; otherwise it will trip a runtime assertion in object_initialize_type() when the C user attempts to in-place initialize the type.
Add a compile-time assertion on the Rust side, so that if we accidentally make the Rust device state larger we know immediately that we need to expand the padding in the C version of the struct.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Link: https://lore.kernel.org/r/20250321112523.1774131-4-peter.maydell@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
269a8f15 |
| 10-Feb-2025 |
Zhao Liu <zhao1.liu@intel.com> |
rust/timer/hpet: add basic HPET timer and HPETState
Add the HPETTimer and HPETState (HPET timer block), along with their basic methods and register definitions.
This is in preparation for supportin
rust/timer/hpet: add basic HPET timer and HPETState
Add the HPETTimer and HPETState (HPET timer block), along with their basic methods and register definitions.
This is in preparation for supporting the QAPI interfaces.
Note, wrap all items in HPETState that may be changed in the callback called by C code into the BqlCell/BqlRefCell.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-9-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
eadb83f9 |
| 10-Feb-2025 |
Zhao Liu <zhao1.liu@intel.com> |
rust: add bindings for timer
Add timer bindings to help handle idiomatic Rust callbacks.
Additionally, wrap QEMUClockType in ClockType binding to avoid unsafe calls in device code.
Signed-off-by:
rust: add bindings for timer
Add timer bindings to help handle idiomatic Rust callbacks.
Additionally, wrap QEMUClockType in ClockType binding to avoid unsafe calls in device code.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-7-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
d015d4cb |
| 25-Jan-2025 |
Zhao Liu <zhao1.liu@intel.com> |
rust: add bindings for memattrs
The MemTxAttrs structure contains bitfield members, and bindgen is unable to generate an equivalent macro definition for MEMTXATTRS_UNSPECIFIED.
Therefore, manually
rust: add bindings for memattrs
The MemTxAttrs structure contains bitfield members, and bindgen is unable to generate an equivalent macro definition for MEMTXATTRS_UNSPECIFIED.
Therefore, manually define a global constant variable MEMTXATTRS_UNSPECIFIED to support calls from Rust code.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250125125137.1223277-6-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
32cad1ff |
| 03-Dec-2024 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
include: Rename sysemu/ -> system/
Headers in include/sysemu/ are not only related to system *emulation*, they are also used by virtualization. Rename as system/ which is clearer.
Files renamed man
include: Rename sysemu/ -> system/
Headers in include/sysemu/ are not only related to system *emulation*, they are also used by virtualization. Rename as system/ which is clearer.
Files renamed manually then mechanical change using sed tool.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Lei Yang <leiyang@redhat.com> Message-Id: <20241203172445.28576-1-philmd@linaro.org>
show more ...
|
#
b278b60d |
| 27-Oct-2024 |
Manos Pitsidianakis <manos.pitsidianakis@linaro.org> |
rust/wrapper.h: define memory_order enum
Add stub definition of memory_order enum in wrapper.h.
Creating Rust bindings from C code is done by passing the wrapper.h header to `bindgen`. This fails w
rust/wrapper.h: define memory_order enum
Add stub definition of memory_order enum in wrapper.h.
Creating Rust bindings from C code is done by passing the wrapper.h header to `bindgen`. This fails when library dependencies that use compiler headers are enabled, and the libclang that bindgen detects does not match the expected clang version. So far this has only been observed with the memory_order enum symbols from stdatomic.h. If we add the enum definition to wrapper.h ourselves, the error does not happen.
Before this commit, if the mismatch happened the following error could come up:
/usr/include/liburing/barrier.h:72:10: error: use of undeclared identifier 'memory_order_release' /usr/include/liburing/barrier.h:75:9: error: use of undeclared identifier 'memory_order_acquire' /usr/include/liburing/barrier.h:75:9: error: use of undeclared identifier 'memory_order_acquire' /usr/include/liburing/barrier.h:68:9: error: use of undeclared identifier 'memory_order_relaxed' /usr/include/liburing/barrier.h:65:17: error: use of undeclared identifier 'memory_order_relaxed' /usr/include/liburing/barrier.h:75:9: error: use of undeclared identifier 'memory_order_acquire' /usr/include/liburing/barrier.h:75:9: error: use of undeclared identifier 'memory_order_acquire' /usr/include/liburing/barrier.h:72:10: error: use of undeclared identifier 'memory_order_release' panicked at [..]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-cli-0.70.1/main.rs:45:36: Unable to generate bindings
To fix this (on my system) I would have to export CLANG_PATH and LIBCLANG_PATH:
export CLANG_PATH=/bin/clang-17 export LIBCLANG_PATH=/usr/lib/llvm-17/lib
With these changes applied, bindgen is successful with both the environment variables set and unset.
Since we're not using those symbols in the bindings (they are only used by dependencies) this does not affect the generated bindings in any way.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Link: https://lore.kernel.org/r/20241027-rust-wrapper-stdatomic-v2-1-dab27bbf93ea@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
6fdc5bc1 |
| 03-Oct-2024 |
Manos Pitsidianakis <manos.pitsidianakis@linaro.org> |
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
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 <pbonzini@redhat.com> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Link: https://lore.kernel.org/r/1be89a27719049b7203eaf2eca8bbb75b33f18d4.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|