| 9ee48867 | 17-Feb-2025 |
Zhao Liu <zhao1.liu@intel.com> |
i386: Fix the missing Rust HPET configuration option
The configuration option of Rust HPET is missing, so that PC machine can't boot with "hpet=on" when QEMU Rust support is enabled.
Add the Rust H
i386: Fix the missing Rust HPET configuration option
The configuration option of Rust HPET is missing, so that PC machine can't boot with "hpet=on" when QEMU Rust support is enabled.
Add the Rust HPET configuration option.
Fixes: d128c341a744 ("i386: enable rust hpet for pc when rust is enabled") Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250217154416.3144571-1-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| d128c341 | 09-Feb-2025 |
Zhao Liu <zhao1.liu@intel.com> |
i386: enable rust hpet for pc when rust is enabled
Add HPET configuration in PC's Kconfig options, and select HPET device (Rust version) if Rust is supported.
Signed-off-by: Zhao Liu <zhao1.liu@int
i386: enable rust hpet for pc when rust is enabled
Add HPET configuration in PC's Kconfig options, and select HPET device (Rust version) if Rust is supported.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-11-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 6e90a8f8 | 09-Feb-2025 |
Zhao Liu <zhao1.liu@intel.com> |
rust/timer/hpet: add qom and qdev APIs support
Implement QOM & QAPI support for HPET device.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-10-
rust/timer/hpet: add qom and qdev APIs support
Implement QOM & QAPI support for HPET device.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-10-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 269a8f15 | 09-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 ...
|
| 0534248a | 09-Feb-2025 |
Zhao Liu <zhao1.liu@intel.com> |
rust/timer/hpet: define hpet_fw_cfg
Define HPETFwEntry structure with the same memory layout as hpet_fw_entry in C.
Further, define the global hpet_cfg variable in Rust which is the same as the C v
rust/timer/hpet: define hpet_fw_cfg
Define HPETFwEntry structure with the same memory layout as hpet_fw_entry in C.
Further, define the global hpet_cfg variable in Rust which is the same as the C version. This hpet_cfg variable in Rust will replace the C version one and allows both Rust code and C code to access it.
The Rust version of hpet_cfg is self-contained, avoiding unsafe access to C code.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-8-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 7630ca2a | 10-Feb-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: convert pl011_create to safe Rust
Not a major change but, as a small but significant step in creating qdev bindings, show how pl011_create can be written without "unsafe" calls (apart f
rust: pl011: convert pl011_create to safe Rust
Not a major change but, as a small but significant step in creating qdev bindings, show how pl011_create can be written without "unsafe" calls (apart from converting pointers to references).
This also provides a starting point for creating Error** bindings.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| a22bd55f | 03-Feb-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: chardev, qdev: add bindings to qdev_prop_set_chr
Because the argument to the function is an Owned<Chardev>, this also adds an ObjectType implementation to Chardev.
Reviewed-by: Zhao Liu <zhao
rust: chardev, qdev: add bindings to qdev_prop_set_chr
Because the argument to the function is an Owned<Chardev>, this also adds an ObjectType implementation to Chardev.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 590faa03 | 17-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: bindings for MemoryRegionOps
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
| 5472a38c | 17-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: qdev: switch from legacy reset to Resettable
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
| 201ef001 | 17-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: qdev: add clock creation
Add a Rust version of qdev_init_clock_in, which can be used in instance_init. There are a couple differences with the C version:
- in Rust the object keeps its own r
rust: qdev: add clock creation
Add a Rust version of qdev_init_clock_in, which can be used in instance_init. There are a couple differences with the C version:
- in Rust the object keeps its own reference to the clock (in addition to the one embedded in the NamedClockList), and the reference is dropped automatically by instance_finalize(); this is encoded in the signature of DeviceClassMethods::init_clock_in, which makes the lifetime of the clock independent of that of the object it holds. This goes unnoticed in the C version and is due to the existence of aliases.
- also, anything that happens during instance_init uses the pinned_init framework to operate on a partially initialized object, and is done through class methods (i.e. through DeviceClassMethods rather than DeviceMethods) because the device does not exist yet. Therefore, Rust code *must* create clocks from instance_init, which is stricter than C.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| ec3eba98 | 31-Oct-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: qom: add object creation functionality
The basic object lifecycle test can now be implemented using safe code!
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzi
rust: qom: add object creation functionality
The basic object lifecycle test can now be implemented using safe code!
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 9955093b | 07-Feb-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: use default set of lints
Being the first crate added to QEMU, pl011 has a rather restrictive Clippy setup. This can be sometimes a bit too heavy on its suggestions, for example
error:
rust: pl011: use default set of lints
Being the first crate added to QEMU, pl011 has a rather restrictive Clippy setup. This can be sometimes a bit too heavy on its suggestions, for example
error: this could be a `const fn` --> hw/char/pl011/src/device.rs:382:5 | 382 | / fn set_read_trigger(&mut self) { 383 | | self.read_trigger = 1; 384 | | } | |_____^
Just use the standard set that is present in rust/Cargo.toml, with just a small adjustment to allow upper case acronyms which are used for register names.
Reported-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 669fab6a | 27-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: include rust_version in Cargo.toml
Tell clippy the minimum supported Rust version for QEMU.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
| f2613789 | 27-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: remove unnecessary Cargo.toml metadata
Some items of Cargo.toml (readme, homepage, repository) are only present because of clippy::cargo warnings being enabled in rust/hw/char/pl011/src/lib.rs
rust: remove unnecessary Cargo.toml metadata
Some items of Cargo.toml (readme, homepage, repository) are only present because of clippy::cargo warnings being enabled in rust/hw/char/pl011/src/lib.rs. But these items are not particularly useful and would be all the same for all Cargo.toml files in the QEMU workspace. Clean them up.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| af7edb1d | 02-Dec-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: qdev: make reset take a shared reference
Because register reset is within a borrow_mut() call, reset does not need anymore a mut reference to the PL011State.
Reviewed-by: Zhao Liu <zhao1.liu@
rust: qdev: make reset take a shared reference
Because register reset is within a borrow_mut() call, reset does not need anymore a mut reference to the PL011State.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 20bcc96f | 17-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: drop use of ControlFlow
It is a poor match for what the code is doing, anyway.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
| b3a29b3d | 17-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: pull device-specific code out of MemoryRegionOps callbacks
read() can now return a simple u64.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat
rust: pl011: pull device-specific code out of MemoryRegionOps callbacks
read() can now return a simple u64.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| c44818a5 | 02-Dec-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: remove duplicate definitions
Unify the "Interrupt" enum and the "INT_*" constants with a struct that contains the bits. The "int_level" and "int_enabled" fields could use a crate such
rust: pl011: remove duplicate definitions
Unify the "Interrupt" enum and the "INT_*" constants with a struct that contains the bits. The "int_level" and "int_enabled" fields could use a crate such as "bitflags".
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| a1ab4eed | 24-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: wrap registers with BqlRefCell
This is a step towards making memory ops use a shared reference to the device type; it's not yet possible due to the calls to character device functions.
rust: pl011: wrap registers with BqlRefCell
This is a step towards making memory ops use a shared reference to the device type; it's not yet possible due to the calls to character device functions.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 49bfe63f | 24-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: extract PL011Registers
Pull all the mutable fields of PL011State into a separate struct.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
| ab6b6a8a | 24-Jan-2025 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: pull interrupt updates out of read/write ops
qemu_irqs are not part of the vmstate, therefore they will remain in PL011State. Update them if needed after regs_read()/regs_write().
App
rust: pl011: pull interrupt updates out of read/write ops
qemu_irqs are not part of the vmstate, therefore they will remain in PL011State. Update them if needed after regs_read()/regs_write().
Apply #[must_use] to functions that return whether the interrupt state could have changed, so that it's harder to forget the call to update().
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 13761277 | 06-Dec-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: extract CharBackend receive logic into a separate function
Prepare for moving all references to the registers and the FIFO into a separate struct.
Reviewed-by: Zhao Liu <zhao1.liu@inte
rust: pl011: extract CharBackend receive logic into a separate function
Prepare for moving all references to the registers and the FIFO into a separate struct.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| 6d314cc0 | 10-Dec-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: extract conversion to RegisterOffset
As an added bonus, this also makes the new function return u32 instead of u64, thus factoring some casts into a single place.
Reviewed-by: Zhao Liu
rust: pl011: extract conversion to RegisterOffset
As an added bonus, this also makes the new function return u32 instead of u64, thus factoring some casts into a single place.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| d1f27ae9 | 14-Nov-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: hide unnecessarily "pub" items from outside pl011::device
The only public interfaces for pl011 are TYPE_PL011 and pl011_create. Remove pub from everything else.
Note: the "allow(dead_c
rust: pl011: hide unnecessarily "pub" items from outside pl011::device
The only public interfaces for pl011 are TYPE_PL011 and pl011_create. Remove pub from everything else.
Note: the "allow(dead_code)" is removed later.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
| efe5719c | 12-Nov-2024 |
Paolo Bonzini <pbonzini@redhat.com> |
rust: pl011: remove unnecessary "extern crate"
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |