aboutsummaryrefslogtreecommitdiff
path: root/rust/wrapper.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2025-03-21 11:25:22 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2025-03-21 12:51:16 +0100
commit5b87a07e76816ed61e5968eb370859a5901b8516 (patch)
treed69ee0508b33d7232662bc842cc17e3439eb9ced /rust/wrapper.h
parent9d116f42a38cb95a33da837e0b0b50d91e28906b (diff)
downloadqemu-5b87a07e76816ed61e5968eb370859a5901b8516.zip
qemu-5b87a07e76816ed61e5968eb370859a5901b8516.tar.gz
qemu-5b87a07e76816ed61e5968eb370859a5901b8516.tar.bz2
hw/char/pl011: Pad PL011State struct to same size as Rust impl
We have some users of the PL011 struct which embed it directly into their own state structs. This means that the Rust version of the device must have a state struct that is the same size or smaller than the C struct. In commit 9b642097d6b7 ("rust: pl011: switch to safe chardev operation") the Rust PL011 state struct changed from having a bindings::CharBackend to a chardev::CharBackend, which made it grow larger than the C version. This results in an assertion at startup when QEMU was built with Rust enabled: $ qemu-system-arm -M raspi2b -display none ERROR:../../qom/object.c:562:object_initialize_with_type: assertion failed: (size >= type->instance_size) The long-term better approach to this problem would be to move our C device code patterns away from "embed a struct" and (back) to "have a pointer to the device", so we can make the C PL011State struct a private implementation detail rather than exposed to its users. For the short term, add a padding field at the end of the C struct so it's big enough that the Rust state struct can fit. Fixes: 9b642097d6b7 ("rust: pl011: switch to safe chardev operation") 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-3-peter.maydell@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/wrapper.h')
0 files changed, 0 insertions, 0 deletions