y
case it's meant to optimize because
brcond_i64 cc_dst,$0x,tsteq,$L1
(test %ebx, %ebx) is 1 byte smaller than
brcond_i64 cc_dst,$0x0,eq,$L1
(test %rbx, %rbx). However, in general it is an improvement, especially
if it avoids placing a large immediate in the constant pool.
Sig
On 1/29/25 13:23, Peter Maydell wrote:
I'm not really strongly opposed to dropping 32-bit host support,
but I don't think a thread on qemu-devel is exactly likely to
get the attention of the people who might be using this
functionality. (You could argue that functionality without
representation a
backtraces
v2->v3: drop PL011Registers borrow before calling PL011State::update()
include full Rust backtraces in test runs
Paolo Bonzini (38):
rust: pl011: fix repr(C) for PL011Class
target/i386: inline gen_jcc into sole caller
target/i386: remove trailing 1 from
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
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 46 --
rust/hw
Reviewed-by: Philippe Mathieu-Daudé
Reviewed-by: Thomas Huth
Signed-off-by: Paolo Bonzini
---
.gitlab-ci.d/buildtest-template.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitlab-ci.d/buildtest-template.yml
b/.gitlab-ci.d/buildtest-template.yml
index 39da7698b09..4cc19239319 100644
On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote:
+fn init_gpio_in FnCall<(&'a Self::Target, u32, u32)>>(&self,
num_lines: u32, _f: F) {
+unsafe extern "C" fn rust_irq_handler FnCall<(&'a T, u32,
u32)>>(
+opaque: *mut c_void,
+line: c_int,
+leve
On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote:
fn read(&mut self, addr: hwaddr, _size: u32) -> u64 {
This can be &self.
let shift: u64 = (addr & 4) * 8;
+match addr {
+HPET_TN_CFG_REG => self.config >> shift, // including interrupt
capabilities
This
On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote:
+ c_nocopy = [
+'QEMUTimer',
+ ]
+ # Used to customize Drop trait
+ foreach struct : c_nocopy
+bindgen_args += ['--no-copy', struct]
+ endforeach
Nice.
+pub use bindings::QEMUTimer;
+
+use crate::{
+bindings::{
+self
On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote:
@@ -5,6 +5,7 @@ edition = "2021"
authors = ["Zhao Liu "]
license = "GPL-2.0-or-later"
description = "IA-PC High Precision Event Timer emulation in Rust"
Please add
rust-version = "1.63.0"
here.
+// SAFETY: all accesses go throug
On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote:
+// Register space for each timer block. (HPET_BASE isn't defined here.)
+const HPET_REG_SPACE_LEN: u64 = 0x400; // 1024 bytes
Use doc comments "///"...
+// Timer N FSB Interrupt Route Register (masked by 0x18)
+const HPET_TN_FSB_ROUTE_REG:
On Mon, Jan 27, 2025 at 8:38 AM Zhao Liu wrote:
>
> > +impl Owned {
> > +/// Convert a raw C pointer into an owned reference to the QOM
> > +/// object it points to. The object's reference count will be
> > +/// decreased when the `Owned` is dropped.
> > +///
> > +/// # Panics
On Sun, Jan 26, 2025 at 3:56 PM Zhao Liu wrote:
>
> Hi Paolo,
>
> On Fri, Jan 17, 2025 at 08:39:55PM +0100, Paolo Bonzini wrote:
> > Date: Fri, 17 Jan 2025 20:39:55 +0100
> > From: Paolo Bonzini
> > Subject: [PATCH 02/10] rust: qom: add reference counting functi
-off-by: Paolo Bonzini
---
rust/hw/char/pl011/Cargo.toml | 3 ---
rust/hw/char/pl011/README.md| 31 ---
rust/hw/char/pl011/src/lib.rs | 14 ++
rust/qemu-api-macros/Cargo.toml | 3 ---
rust/qemu-api-macros/README.md | 1 -
5 files changed, 6
Remove duplicate or stale information, and add the rustc version to
help clippy produce good warnings.
Paolo
Paolo Bonzini (2):
rust: remove unnecessary Cargo.toml metadata
rust: include rust_version in Cargo.toml
rust/hw/char/pl011/Cargo.toml | 4 +---
rust/hw/char/pl011
Signed-off-by: Paolo Bonzini
---
docs/devel/index-process.rst | 1 +
docs/devel/rust.rst | 423 +++
2 files changed, 424 insertions(+)
create mode 100644 docs/devel/rust.rst
diff --git a/docs/devel/index-process.rst b/docs/devel/index-process.rst
Tell clippy the minimum supported Rust version for QEMU.
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/Cargo.toml | 1 +
rust/hw/char/pl011/src/device_class.rs | 1 -
rust/qemu-api-macros/Cargo.toml| 1 +
rust/qemu-api/Cargo.toml | 1 +
4 files changed, 3
Signed-off-by: Paolo Bonzini
---
.gitlab-ci.d/buildtest-template.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitlab-ci.d/buildtest-template.yml
b/.gitlab-ci.d/buildtest-template.yml
index 39da7698b09..4cc19239319 100644
--- a/.gitlab-ci.d/buildtest-template.yml
+++ b/.gitlab-ci.d
On 1/28/25 15:19, Stefan Hajnoczi wrote:
thread '' panicked at 'already borrowed',
rust/qemu-api/libqemu_api.rlib.p/structured/cell.rs:450:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
https://gitlab.com/qem
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
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 137 ++-
rust/hw/char/pl011/src/lib.rs| 2
/i386: new Sierra Forest and Clearwater Forest models
* rust: type-safe vmstate implementation
* rust: use interior mutability for PL011
* rust: clean ups
* memtxattrs: remove usage of bitfields from MEMTXATTRS_UNSPECIFIED
--------
Paolo B
It's been roughly two months since my previous posting of a roadmap
for Rust in QEMU, so it's time for an update. While the project is
still at an experimental phase, the amount of functionality available
from safe Rust is enough that it could be considered for new devices.
As before, this mostl
On Mon, Jan 27, 2025 at 12:53 PM Zhao Liu wrote:
> > @@ -490,20 +490,24 @@ impl PL011State {
> > /// location/instance. All its fields are expected to hold unitialized
> > /// values with the sole exception of `parent_obj`.
> > unsafe fn init(&mut self) {
> > +static PL011_O
On Mon, Jan 27, 2025 at 11:12 AM Zhao Liu wrote:
> > +/// If not None, this is called when the object for entry into reset,
> > once
> > +/// every object in the system which is being reset has had its
> > +/// @phases.enter method called. At this point devices can do actions
>
> Mayb
class_base_init() before class_init()
qom: Introduce class_post_init() handler
include/qom/object.h | 17 ++---
qom/object.c | 14 --
rust/qemu-api/src/qom.rs | 8 +++-
3 files changed, 29 insertions(+), 10 deletions(-)
Acked-by: Paolo Bonzini
0:5
> note: run with `RUST_BACKTRACE=1` environment variable to display a
> backtrace
> fatal runtime error: failed to initiate panic, error 5
>
> https://gitlab.com/qemu-project/qemu/-/jobs/8946857796
Yes, it's a real bug.
Paolo
>
> Thanks,
> Stefan
>
> >
&g
Queued, thanks.
Paolo
/i386: new Sierra Forest and Clearwater Forest models
* rust: type-safe vmstate implementation
* rust: use interior mutability for PL011
* rust: clean ups
* memtxattrs: remove usage of bitfields from MEMTXATTRS_UNSPECIFIED
--------
Paolo B
Pull all the mutable fields of PL011State into a separate struct.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 251 ++---
rust/hw/char/pl011/src/device_class.rs | 46 +++--
2 files changed, 168 insertions(+), 129 deletions
y
case it's meant to optimize because
brcond_i64 cc_dst,$0x,tsteq,$L1
(test %ebx, %ebx) is 1 byte smaller than
brcond_i64 cc_dst,$0x0,eq,$L1
(test %rbx, %rbx). However, in general it is an improvement, especially
if it avoids placing a large immediate in the constant pool.
Sig
From: Zhao Liu
Make sure MemTxAttrs is packed into 8 bytes and does not exceed 8 bytes.
Suggested-by: Philippe Mathieu-DaudÃ
Signed-off-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121151322.171832-3-zhao1@intel.com
Signed-off-by: Paolo Bonzini
---
include/exec/memattrs.h | 2 ++
1
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
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl0
Prepare for moving all references to the registers and the FIFO into a
separate struct.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 15 +--
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/rust/hw/char/pl011/src/device.rs b
It is a poor match for what the code is doing, anyway.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 39 +++-
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/vmstate.rs | 61 ++--
1 file changed, 58 insertions(+), 3 deletions(-)
diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/vmstate.rs
index a262c315da1..9ac699b73b7 100644
--- a
read() can now return a simple u64.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 23 +--
rust/hw/char/pl011/src/memory_ops.rs | 18 ++
2 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/rust/hw
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
index 994c2fc0593..65a1234b9ff 100644
--- a/rust/hw/char/pl011/src/device.rs
+++ b/rust
reserved
members to ensure that the whole structure is packed into 8 bytes.
Suggested-by: Richard Henderson
Suggested-by: Paolo Bonzini
Signed-off-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121151322.171832-2-zhao1@intel.com
Signed-off-by: Paolo Bonzini
---
include/exec/memattrs.h | 19
Reviewed-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121020650.1899618-4-tao1...@linux.intel.com
Signed-off-by: Paolo Bonzini
---
target/i386/cpu.h | 33 +---
target/i386/cpu.c | 135 ++
2 files changed, 162 insertions(+), 6 deletions(-)
diff
instructions for the MO_TL case.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-14-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 23 +++
1 file changed, 15 insertions(+), 8
rnel.org/r/20250121020650.1899618-5-tao1...@linux.intel.com
Signed-off-by: Paolo Bonzini
---
docs/system/cpu-models-x86.rst.inc | 50 +++---
1 file changed, 46 insertions(+), 4 deletions(-)
diff --git a/docs/system/cpu-models-x86.rst.inc
b/docs/system/cpu-models-x86.rst
From: Zhao Liu
List all the necessary bindings to better identify gaps in rust/qapi.
And include the bindings wrapped by rust/qapi instead mapping the raw
bindings directly.
Inspired-by: Paolo Bonzini
Signed-off-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121140457.84631-3-zhao1
Signed-off-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/tests/tests.rs | 56 ++--
1 file changed, 53 insertions(+), 3 deletions(-)
diff --git a/rust/qemu-api/tests/tests.rs b/rust/qemu-api/tests/tests.rs
index 526c3f4f8ea..5c3e75ed3d5 100644
--- a
Because register reset is within a borrow_mut() call, reset
does not need anymore a mut reference to the PL011State.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 4 ++--
rust/qemu-api/src/qdev.rs| 2 +-
2 files changed, 3 insertions(+), 3
Place struct_name before field_name, similar to offset_of.
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device_class.rs | 2 +-
rust/qemu-api/src/vmstate.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/hw/char/pl011/src/device_class.rs
b/rust
s passed to C to mutable pointers.
Thus, make REALIZE accept immutable reference.
Signed-off-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121140457.84631-2-zhao1@intel.com
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 10 +-
rust/qemu-api/src/qdev.rs
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/lib.rs | 4
1 file changed, 4 deletions(-)
diff --git a/rust/hw/char/pl011/src/lib.rs b/rust/hw/char/pl011/src/lib.rs
index f30f9850ad4..d10f0805aac 100644
--- a/rust/hw/char/pl011/src/lib.rs
+++ b/rust/hw/char
Keep vmstate_clock!; because it uses a field of type VMStateDescription,
it cannot be converted to the VMState trait without access to the
const_refs_static feature.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/vmstate.rs | 274 +++
1
Paolo Bonzini
Signed-off-by: Zhao Liu
Link: https://lore.kernel.org/r/20250123163143.679841-1-zhao1@intel.com
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/zeroable.rs | 137 +++---
1 file changed, 61 insertions(+), 76 deletions(-)
diff --git a/rust/qemu-ap
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
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 113 +--
1 file changed, 64 insertions(+), 49
vulnerabilities are
mitigated in stepping 3.
Tested-by: Xuelian Guo
Signed-off-by: Tao Su
Reviewed-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121020650.1899618-2-tao1...@linux.intel.com
Signed-off-by: Paolo Bonzini
---
target/i386/cpu.c | 19 +++
1 file changed, 19 insertions
by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/prelude.rs | 2 +
rust/qemu-api/src/vmstate.rs | 113 +--
2 files changed, 109 insertions(+), 6 deletions(-)
diff --git a/rust/qemu-api/src/prelude.rs b/rust/qemu-api/src/prelude.rs
index 4ea70b9c823
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 3 ++-
rust/hw/char/pl011/src/device_class.rs | 36 +-
rust/hw/char/pl011/src/lib.rs | 6 +
3 files changed, 26 insertions(+), 19 deletions(-)
diff --git a
interrupts.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-12-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 55 +
1 file changed, 49 insertions(+), 6 deletions
Arrays, pointers and cells use a VMStateField that is based on that
for the inner type. The implementation therefore delegates to the
VMState implementation of the inner type.
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/vmstate.rs | 79 +++-
1 file
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
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 2 +-
rust/hw/char/pl011/src/devic
Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 84 ++--
1 file changed, 48 insertions(+), 36 deletions(-)
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
index de5110038a5..9cac9d352a2 100644
--- a/ru
VMStateInfos in an enum, and going from enum to &VMStateInfo
only when building the VMStateField.
The same thing cannot be done with VMS_STRUCT because the set of
VMStateDescriptions extends to structs defined by the devices.
Therefore, structs and cells cannot yet use vmstate_of!.
Signed-off-by: P
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/vmstate.rs | 42 ++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/vmstate.rs
index 211c3d096b7..2b14d4839df 100644
--- a/rust/qemu-api/src
This shortens a bit the constants. Do not bother using it
in the vmstate macros since most of them will go away soon.
Reviewed-by: Zhao Liu
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/vmstate.rs | 18 +++---
rust/qemu-api/src/zeroable.rs | 31
It is not type safe, but it's the best that can be done without
const_refs_static. It can also be used with BqlCell and BqlRefCell.
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/vmstate.rs | 33 +
1 file changed, 33 insertions(+)
diff --git a/rust/qem
Do not use new_unchecked; the effect is the same, but the
code is easier to read and unsafe regions become smaller.
Likewise, NonNull::new can be used instead of assertion and
followed by as_ref() or as_mut() instead of dereferencing the
pointer.
Suggested-by: Zhao Liu
Signed-off-by: Paolo
It only differs in a single call to gen_jcc, so use a "bool" argument
to distinguish the two cases; do not duplicate code.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-4-pbonz...@redhat.com
Signed-off-by: Pao
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
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 40 ++
rust/hw
This is not needed anymore now that gen_jcc has been eliminated
(merged into the similarly-named gen_Jcc, where the uppercase letter
gives away that it is an emission function).
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-3
o1@intel.com
Signed-off-by: Paolo Bonzini
---
stubs/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stubs/meson.build b/stubs/meson.build
index e91614a874d..a8b3aeb5645 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -57,8 +57,8 @@ if have_user
stub
RF must be set on traps and interrupts from a string instruction,
except if they occur after the last iteration. Ensure it is set
before giving the main loop a chance to execute.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-8
additional
mitigation is required to prevent BHI.
Make BHI_NO bit available to guests.
Tested-by: Xuelian Guo
Signed-off-by: Tao Su
Reviewed-by: Zhao Liu
Link: https://lore.kernel.org/r/20250121020650.1899618-3-tao1...@linux.intel.com
Signed-off-by: Paolo Bonzini
---
target/i386/cpu.c | 2 +-
1
(reg, cx_mask).
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-10-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target/i386
what
x86_restore_state_to_opc would do.
Signed-off-by: Paolo Bonzini
Link: https://lore.kernel.org/r/20241215090613.89588-9-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 24 +---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/target/i38
.
For clarity, mark the cc_op explicitly as DYNAMIC even if at the end
of the translation block; the cc_op can come from either the previous
instruction or the string instruction, and currently we rely on
a gen_update_cc_op() that is hidden in the bowels of gen_jcc() to
spill cc_op and mark it cle
This is a common operation that is executed many times in rep
movs or rep stos loops. It can improve performance by several
percentage points.
Signed-off-by: Paolo Bonzini
Link: https://lore.kernel.org/r/20241215090613.89588-13-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386
Allow using them in the code that translates REP/REPZ, without
forward declarations.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-7-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 80
The same "if" is present in all generator functions for string instructions.
Push it inside gen_repz() and gen_repz_nz() instead.
Signed-off-by: Paolo Bonzini
Link: https://lore.kernel.org/r/20241215090613.89588-5-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/t
Now that everything has been cleaned up, look at DF and prefixes
in a single function, and call that one from gen_repz and gen_repz_nz.
Suggested-by: Richard Henderson
Reviewed-by: Richard Henderson
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 34
The code of gen_Jcc is very similar to gen_LOOP* and gen_JCXZ, but this
is hidden by gen_jcc.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r/20241215090613.89588-2-pbonz...@redhat.com
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 8
work for subsequent changes. In particular, introducing
cx_next prepares for when ECX will be decremented *before* calling
fn(s, ot), and therefore cannot yet be written back to cpu_regs.
Signed-off-by: Paolo Bonzini
Reviewed-by: Richard Henderson
Link: https://lore.kernel.org/r
On 1/23/25 16:10, Zhao Liu wrote:
Another solution would be to implement Zeroable for __BindgenBitfieldUnit in
bindings.rs, but this is much nicer! It works even with old Rust versions
and, even though it needs manual implementation of the trait each type, it
doesn't require enumerating the fiel
Il gio 23 gen 2025, 10:05 Zhao Liu ha scritto:
> > I will double check. But I do see that there is no mut access inside, at
> > least not until the qemu_chr_fe_accept_input() is moved here.
> Unfortunately
> > until all MemoryRegion and CharBackend bindings are available the uses of
> > &mut and
On Wed, Jan 22, 2025 at 2:59 PM Vitalii Mordan wrote:
>
> This patch addresses a potential data race involving the global variable
> goflag in the rcutorture test. The issue is resolved by adding the atomic
> qualifier to ensure proper synchronization.
Hello!
QEMU does not use _Atomic; in genera
Il gio 23 gen 2025, 04:25 Zhao Liu ha scritto:
> > --- a/rust/hw/char/pl011/src/device_class.rs
> > +++ b/rust/hw/char/pl011/src/device_class.rs
> > @@ -6,11 +6,11 @@
> > use std::os::raw::{c_int, c_void};
> >
> > use qemu_api::{
> > -bindings::*, c_str, vmstate_clock, vmstate_fields, vmsta
Il gio 23 gen 2025, 06:27 Zhao Liu ha scritto:
> On Fri, Jan 17, 2025 at 10:26:54AM +0100, Paolo Bonzini wrote:
> > Date: Fri, 17 Jan 2025 10:26:54 +0100
> > From: Paolo Bonzini
> > Subject: [PATCH 07/10] rust: pl011: wrap registers with BqlRefCell
> > X-Ma
On 1/22/25 13:33, Zhao Liu wrote:
On Fri, Jan 17, 2025 at 10:00:41AM +0100, Paolo Bonzini wrote:
Date: Fri, 17 Jan 2025 10:00:41 +0100
From: Paolo Bonzini
Subject: [PATCH 05/10] rust: vmstate: implement VMState for scalar types
X-Mailer: git-send-email 2.47.1
Scalar types are those that have
Il mer 22 gen 2025, 17:31 Zhao Liu ha scritto:
> > if event == bindings::QEMUChrEvent::CHR_EVENT_BREAK &&
> !self.loopback_enabled() {
> > -self.put_fifo(registers::Data::BREAK.into());
> > +let update = self.put_fifo(registers::Data::BREAK.into());
>
> We can omi
On 1/22/25 15:59, Zhao Liu wrote:
if size > 0 {
debug_assert!(!buf.is_null());
-state.as_mut().put_fifo(c_uint::from(buf.read_volatile()))
An extra question...here I'm not sure, do we really need read_volatile?
No, the buffer is not guest visible. It will
On 1/22/25 15:34, Zhao Liu wrote:
On Fri, Jan 17, 2025 at 10:26:50AM +0100, Paolo Bonzini wrote:
Date: Fri, 17 Jan 2025 10:26:50 +0100
From: Paolo Bonzini
Subject: [PATCH 03/10] rust: pl011: extract conversion to RegisterOffset
X-Mailer: git-send-email 2.47.1
As an added bonus, this also
Now that everything has been cleaned up, look at DF and prefixes
in a single function, and call that one from gen_repz and gen_repz_nz.
Signed-off-by: Paolo Bonzini
---
target/i386/tcg/translate.c | 34 ++
1 file changed, 14 insertions(+), 20 deletions(-)
diff
Now that everything has been cleaned up, look at DF and prefixes
in a single function, and call that one from gen_repz and gen_repz_nz.
Based-on: <20241215090613.89588-1-pbonz...@redhat.com>
Suggested-by: Richard Henderson
Signed-off-by: Paolo Bonzini
---
This was requested
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs
index c95ab49fd62..4f1080ff19f 100644
--- a/rust/hw/char/pl011/src/device.rs
+++ b/rust/hw/char/pl011/src
On 1/21/25 15:04, Zhao Liu wrote:
(Resend the series since it was missed on https://lore.kernel.org/qemu-devel/.)
Hi,
This series includes the following cleanups:
* Patch 1: Make realize() safe to only accept immutable self
reference, which is in prepare to introduce gpio bindin
On 1/21/25 16:43, Zhao Liu wrote:
Configuring "--enable-user --disable-system --enable-tools" causes the
build failure with the following information:
/usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function `device_finalize':
/qemu/build/../hw/core/qdev.c:688: undefined reference to
`qapi_even
Queued with the tweaks suggested by Zoltan and Zhao; thanks!
Paolo
On 1/20/25 17:38, Zhao Liu wrote:
Thanks for the reminder, yes it is currently full. I found I missed
a commnet from Paolo [*], that he suggested only convert `unspecified`
to a bool. My bad :-(
It still raises the size to 8 bytes but saves spare space, like:
typedef struct MemTxAttrs {
un
On 1/20/25 17:52, Zhao Liu wrote:
Sorry I missed this comment before...
Now I have a MemTxAttrs like,
typedef struct MemTxAttrs {
unsigned int secure:1;
unsigned int space:2;
unsigned int user:1;
unsigned int memory:1;
unsigned int requester_id:16;
unsigned int pid
stricter than C.
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 28 +---
rust/qemu-api/src/prelude.rs | 2 +
rust/qemu-api/src/qdev.rs| 76 ++--
rust/qemu-api/src/vmstate.rs | 4 +-
4 files changed, 87 insertions(+), 23
Signed-off-by: Paolo Bonzini
---
meson.build | 1 +
rust/hw/char/pl011/src/device.rs | 10 ++-
rust/qemu-api/src/qdev.rs| 116 ---
rust/qemu-api/tests/tests.rs | 5 +-
4 files changed, 102 insertions(+), 30 deletions(-)
diff
This is needed for the MemoryRegionOps to be declared as static;
Rust requires static elements to be Sync.
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/bindings.rs | 19 ++-
rust/qemu-api/src/irq.rs | 3 +++
2 files changed, 21 insertions(+), 1 deletion(-)
diff
In practice it has to be implemented always in order to access an
implementation of ClassInitImpl. Make the relationship
explicit in the code.
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/qdev.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/qemu-api/src
It is possible to enforce
that a callback is valid by adding a "let _: () = F::ASSERT_IS_SOME" before
the invocation of F::call.
Signed-off-by: Paolo Bonzini
---
rust/qemu-api/src/callbacks.rs | 97 ++
1 file changed, 97 insertions(+)
diff --git a
From: Zhao Liu
missing signed-off-by from zhao
---
rust/qemu-api/tests/tests.rs | 56 ++--
1 file changed, 53 insertions(+), 3 deletions(-)
diff --git a/rust/qemu-api/tests/tests.rs b/rust/qemu-api/tests/tests.rs
index 526c3f4f8ea..5c3e75ed3d5 100644
--- a/rust/q
The basic object lifecycle test can now be implemented using safe code!
Signed-off-by: Paolo Bonzini
---
rust/hw/char/pl011/src/device.rs | 13 -
rust/qemu-api/src/prelude.rs | 1 +
rust/qemu-api/src/qom.rs | 23 +--
rust/qemu-api/tests/tests.rs
1 - 100 of 15013 matches
Mail list logo