qemu/include
Peter Maydell 5b87a07e76 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 9b642097d6 ("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: 9b642097d6 ("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>
2025-03-21 12:51:16 +01:00
..
accel cpus: Introduce SysemuCPUOps::has_work() handler 2025-03-09 17:00:47 +01:00
authz Prefer 'on' | 'off' over 'yes' | 'no' for bool options 2021-01-29 17:07:53 +00:00
block aio-posix: Separate AioPolledEvent per AioHandler 2025-03-13 17:57:23 +01:00
chardev chardev/char-hub: implement backend chardev aggregator 2025-02-03 13:57:08 +04:00
crypto crypto: Remove qcrypto_tls_session_get_handshake_status 2025-02-14 15:19:03 -03:00
disas disas: Fix build against Capstone v6 (again) 2024-11-05 10:09:59 +00:00
exec system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' 2025-03-11 17:01:14 +01:00
fpu fpu: Move m68k_denormal fmt flag into floatx80_behaviour 2025-02-25 15:32:57 +00:00
gdbstub gdbstub/helpers: Introduce ldtul_$endian_p() helpers 2024-10-15 11:55:09 -03:00
hw hw/char/pl011: Pad PL011State struct to same size as Rust impl 2025-03-21 12:51:16 +01:00
io io: Add a read flag for relaxed EOF 2025-02-14 15:19:04 -03:00
libdecnumber Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
migration migration: cpr_is_incoming 2025-03-14 09:29:19 -03:00
monitor monitor: Remove obsolete stubs 2024-06-30 19:51:44 +03:00
net net: checksum: Convert data to void * 2024-11-25 13:59:50 +08:00
qapi error: define g_autoptr() cleanup function for the Error type 2025-03-06 06:47:33 +01:00
qemu -----BEGIN PGP SIGNATURE----- 2025-03-11 09:26:40 +08:00
qobject qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
qom qom: remove unused field 2025-01-10 23:34:44 +01:00
scsi hw/ufs: Support for UFS logical unit 2023-09-07 14:01:29 -04:00
semihosting semihosting/console: Avoid including 'cpu.h' 2025-01-17 10:44:00 +00:00
standard-headers linux-headers: Update to Linux v6.14-rc3 2025-03-04 15:42:54 +10:00
system Block layer patches 2025-03-14 09:31:13 +08:00
tcg tcg: Introduce the 'z' constraint for a hardware zero register 2025-02-18 08:29:03 -08:00
ui ui/input-legacy.c: remove unused legacy qemu_add_kbd_event_handler() function 2024-11-08 11:06:42 +01:00
user user: Extract common MMAP API to 'user/mmap.h' 2025-03-09 14:54:32 +01:00
elf.h util: spelling fixes 2023-08-31 19:47:43 +02:00
glib-compat.h Bump minimum glib version to v2.66 2024-05-14 12:46:24 +02:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-main.h ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00