[PATCH 0/2] qom: pass TargetInfo to is_available

Yonggang Luo posted 2 patches 3 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260903205018.975-1-luoyonggang@gmail.com
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Helge Deller <deller@gmx.de>
bsd-user/main.c                 |  1 +
hw/arm/aspeed_ast27x0-fc.c      |  2 +-
hw/arm/aspeed_ast27x0_evb.c     |  4 ++--
hw/arm/raspi.c                  |  4 ++--
hw/arm/raspi4b.c                |  2 +-
include/qemu/target-info-impl.h | 13 ++++---------
include/qemu/target-info-init.h | 18 ++++++++++--------
include/qemu/target-info.h      | 18 ++++++++++++++++++
include/qom/object.h            | 26 +++++++++++++++++++++++---
linux-user/main.c               |  1 +
qom/object.c                    | 15 ++++++++++++++-
target-info-qom.c               |  9 +--------
target-info.c                   | 14 ++++++++++++--
13 files changed, 90 insertions(+), 37 deletions(-)
[PATCH 0/2] qom: pass TargetInfo to is_available
Posted by Yonggang Luo 3 weeks, 1 day ago
TypeInfo.is_available currently has no TargetInfo argument, so QOM
cannot ask a type whether it is available for the selected target
without a wrapper around target_aarch64() or similar. This series
moves target selection into QOM and passes TargetInfo into
is_available.

- Move target_info() from target-info-qom.c into qom/object.c so QOM
  can read the current TargetInfo without a target-info-qom cycle.
  Add target_info_select() to install the TargetInfo once.
  target_info() is NULL until that call. Keep TargetInfo as an
  incomplete type in object.h. User-mode binaries select the sole
  TargetInfo from MODULE_INIT_TARGET_INFO, which now runs before
  MODULE_INIT_QOM.
- Change TypeInfo.is_available to take const TargetInfo *. Add
  target_is_riscv64() and target_is_aarch64() for TypeInfo callbacks.
  Keep target_riscv64() and target_aarch64() as wrappers around the
  current TargetInfo. Point existing ARM machine is_available
  callbacks at target_is_aarch64().

Yonggang Luo (2):
  target-info: move selection into QOM
  qom: pass TargetInfo to is_available

 bsd-user/main.c                 |  1 +
 hw/arm/aspeed_ast27x0-fc.c      |  2 +-
 hw/arm/aspeed_ast27x0_evb.c     |  4 ++--
 hw/arm/raspi.c                  |  4 ++--
 hw/arm/raspi4b.c                |  2 +-
 include/qemu/target-info-impl.h | 13 ++++---------
 include/qemu/target-info-init.h | 18 ++++++++++--------
 include/qemu/target-info.h      | 18 ++++++++++++++++++
 include/qom/object.h            | 26 +++++++++++++++++++++++---
 linux-user/main.c               |  1 +
 qom/object.c                    | 15 ++++++++++++++-
 target-info-qom.c               |  9 +--------
 target-info.c                   | 14 ++++++++++++--
 13 files changed, 90 insertions(+), 37 deletions(-)

-- 
2.52.0.windows.1