Skip to content

qom: module loading cleanups

Paolo Bonzini qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5qom: remove unused functioninclude/qom/object.h qom/object.c+0 -161 reply
2/5qom: use object_new_with_class when possiblehw/core/qdev.c qom/object_interfaces.c qom/qom-qmp-cmds.c+5 -41 reply
3/5qom: centralize module-loading functionalityqom/object.c+36 -360 replies
4/5qom: let object_new use a module if the type is not presenthw/core/qdev.c qom/object.c+1 -170 replies
5/5qom: allow user-creatable classes to be in modulesqom/object_interfaces.c qom/qom-qmp-cmds.c+2 -20 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDaniel P. BerrangéRichard HendersonPhilippe Mathieu-Daudé
SeriesR-b
1/5R-b
2/5R-b
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/5] qom: module loading cleanups

While looking at possible Rust APIs for object_new/qdev_new (one of the functions that rust/hw/char/pl011 uses via FFI) I noticed that the support for modules in QOM APIs is quite random.

In particular, loading modules is done by object_initialize() and qdev_new(), but not by object_new(); furthermore, the loading code is duplicated between object_initialize() and module_object_class_by_name(). This series fixes that.

Patches 1-2 are small cleanups.

Patches 3-4 let object_new() use a module if the type is not present, like object_initialize() already does. To get there, all calls to type_get_by_name() are changed to either type_get_by_name_noload() (the old function) or type_get_or_load_by_name() (which looks at modules like object_initialize() and module_object_class_by_name() do).

This is enough to let Rust code use a single function object_new() to create QOM objects; the function can be wrapped to allow writing something like "PL011State::new()" instead of object_new(TYPE_PL011) as *mut PL011State".

Patch 5 finally allows modularized user-creatable classes, which are not allowed just because the code uses the non-module-friendly object_class_by_name(). While there are no modularized user-creatable classes right now, there is no real difference between them and character devices (which do allow modularization). This patch could be left out if desired.

Paolo

Paolo Bonzini (5):
qom: remove unused function
qom: use object_new_with_class when possible
qom: centralize module-loading functionality
qom: let object_new use a module if the type is not present
qom: allow user-creatable classes to be in modules

 include/qom/object.h    |  8 -----
 hw/core/qdev.c          | 21 ++---------
 qom/object.c            | 80 +++++++++++++++++++----------------------
 qom/object_interfaces.c |  4 +--
 qom/qom-qmp-cmds.c      |  4 +--
 5 files changed, 43 insertions(+), 74 deletions(-)
Signature · 1 line
2.47.0