From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Pierrick Bouvier <pierrick.bouvier@linaro.org>, qemu-devel@nongnu.org
Cc: Anton Johansson <anjo@rev.ng>,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [RFC PATCH v2 02/11] qemu: Convert target_name() to TargetInfo API
Date: Fri, 18 Apr 2025 16:02:10 +0200 [thread overview]
Message-ID: <3fc281a5-3a6b-47d6-bead-3a93f331a258@linaro.org> (raw)
In-Reply-To: <cff3276a-0a17-406d-a7d2-0c932d1fb1f4@linaro.org>
On 18/4/25 05:01, Pierrick Bouvier wrote:
> On 4/17/25 17:50, Philippe Mathieu-Daudé wrote:
>> Have target_name() be a target-agnostic method, dispatching
>> to a per-target TargetInfo singleton structure.
>> By default a stub singleton is used. No logical change
>> expected.
>>
>> Inspired-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> meson.build | 3 +++
>> include/hw/core/cpu.h | 2 --
>> include/qemu/target_info-impl.h | 23 +++++++++++++++++++++++
>> include/qemu/target_info.h | 19 +++++++++++++++++++
>> cpu-target.c | 5 -----
>> hw/core/machine-qmp-cmds.c | 1 +
>> plugins/loader.c | 2 +-
>> system/vl.c | 2 +-
>> target_info-stub.c | 19 +++++++++++++++++++
>> target_info.c | 16 ++++++++++++++++
>> 10 files changed, 83 insertions(+), 9 deletions(-)
>> create mode 100644 include/qemu/target_info-impl.h
>> create mode 100644 include/qemu/target_info.h
>> create mode 100644 target_info-stub.c
>> create mode 100644 target_info.c
>> diff --git a/target_info-stub.c b/target_info-stub.c
>> new file mode 100644
>> index 00000000000..1e44bb6f6fb
>> --- /dev/null
>> +++ b/target_info-stub.c
>> @@ -0,0 +1,19 @@
>> +/*
>> + * QEMU target info stubs
>> + *
>> + * Copyright (c) Linaro
>> + *
>> + * SPDX-License-Identifier: GPL-2.0-or-later
>> + */
>> +
>> +#include "qemu/osdep.h"
>> +#include "qemu/target_info-impl.h"
>> +
>> +static const TargetInfo target_info_stub = {
>> + .name = TARGET_NAME,
>> +};
>> +
>> +const TargetInfo *target_info(void)
>> +{
>> + return &target_info_stub;
>> +}
>> diff --git a/target_info.c b/target_info.c
>> new file mode 100644
>> index 00000000000..877a6a15014
>> --- /dev/null
>> +++ b/target_info.c
>> @@ -0,0 +1,16 @@
>> +/*
>> + * QEMU binary/target helpers
>> + *
>> + * Copyright (c) Linaro
>> + *
>> + * SPDX-License-Identifier: GPL-2.0-or-later
>> + */
>> +
>> +#include "qemu/osdep.h"
>> +#include "qemu/target_info-impl.h"
>> +#include "qemu/target_info.h"
>> +
>> +const char *target_name(void)
>> +{
>> + return target_info()->name;
>> +}
>
> What is the benefit to have two different files (common and specific)?
> target_name() can be inline in the same header, returning the matching
> field in existing target_info, which does not need any specialization
> per target.
common interface exposed target-agnostic, dispatching to target-specific
implementation (providing a stub we'll remove once all targets converted).
What would you suggest?
next prev parent reply other threads:[~2025-04-18 14:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 0:50 [RFC PATCH v2 00/11] single-binary: Make hw/arm/ common Philippe Mathieu-Daudé
2025-04-18 0:50 ` [RFC PATCH v2 01/11] qapi: Rename TargetInfo structure as BinaryTargetInfo Philippe Mathieu-Daudé
2025-04-18 2:55 ` Pierrick Bouvier
2025-04-18 0:50 ` [RFC PATCH v2 02/11] qemu: Convert target_name() to TargetInfo API Philippe Mathieu-Daudé
2025-04-18 3:01 ` Pierrick Bouvier
2025-04-18 14:02 ` Philippe Mathieu-Daudé [this message]
2025-04-18 16:23 ` Pierrick Bouvier
2025-04-18 17:15 ` Philippe Mathieu-Daudé
2025-04-18 0:50 ` [RFC PATCH v2 03/11] system/vl: Filter machine list available for a particular target binary Philippe Mathieu-Daudé
2025-04-18 3:06 ` Pierrick Bouvier
2025-04-18 14:14 ` Philippe Mathieu-Daudé
2025-04-18 0:50 ` [RFC PATCH v2 04/11] hw/arm: Register TYPE_TARGET_ARM/AARCH64_CPU QOM interfaces Philippe Mathieu-Daudé
2025-04-18 3:07 ` Pierrick Bouvier
2025-04-18 14:07 ` Philippe Mathieu-Daudé
2025-04-18 16:30 ` Pierrick Bouvier
2025-04-18 17:04 ` Philippe Mathieu-Daudé
2025-04-18 17:07 ` Pierrick Bouvier
2025-04-18 17:10 ` Philippe Mathieu-Daudé
2025-04-18 17:23 ` Pierrick Bouvier
2025-04-18 17:32 ` Philippe Mathieu-Daudé
2025-04-19 1:17 ` Pierrick Bouvier
2025-04-18 0:50 ` [RFC PATCH v2 05/11] hw/arm: Filter machine types for qemu-system-aarch64 binary Philippe Mathieu-Daudé
2025-04-18 0:50 ` [RFC PATCH v2 06/11] hw/arm: Filter machine types for qemu-system-arm binary Philippe Mathieu-Daudé
2025-04-18 3:08 ` Pierrick Bouvier
2025-04-18 0:50 ` [RFC PATCH v2 07/11] hw/core: Allow ARM/Aarch64 binaries to use the 'none' machine Philippe Mathieu-Daudé
2025-04-18 3:32 ` Pierrick Bouvier
2025-04-18 0:50 ` [RFC PATCH v2 08/11] config/target: Implement per-binary TargetInfo structure (ARM) Philippe Mathieu-Daudé
2025-04-18 3:39 ` Pierrick Bouvier
2025-04-18 4:02 ` Pierrick Bouvier
2025-04-18 11:20 ` Philippe Mathieu-Daudé
2025-04-18 0:50 ` [RFC PATCH v2 09/11] config/target: Implement per-binary TargetInfo structure (Aarch64) Philippe Mathieu-Daudé
2025-04-18 3:34 ` Pierrick Bouvier
2025-04-18 0:50 ` [RFC PATCH v2 10/11] hw/arm/aspeed: Build objects once Philippe Mathieu-Daudé
2025-04-18 4:02 ` Pierrick Bouvier
2025-04-18 0:50 ` [RFC PATCH v2 11/11] hw/arm/raspi: " Philippe Mathieu-Daudé
2025-04-18 4:03 ` Pierrick Bouvier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3fc281a5-3a6b-47d6-bead-3a93f331a258@linaro.org \
--to=philmd@linaro.org \
--cc=anjo@rev.ng \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).