From: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: philmd@linaro.org
Subject: Re: [PATCH 2/5] target-info: Expose target_info as const data
Date: Mon, 11 May 2026 19:22:15 -0700 [thread overview]
Message-ID: <28e6ad6e-ef06-4cc3-bf17-c7a880b5e500@oss.qualcomm.com> (raw)
In-Reply-To: <20260511190634.472174-3-richard.henderson@linaro.org>
On 5/11/2026 12:06 PM, Richard Henderson wrote:
> Expose a const TargetInfo structure instead of a function
> returning a const pointer.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> include/qemu/target-info-impl.h | 11 ++++----
> include/qemu/target-info-init.h | 45 ++++++++++++++++++++++---------
> configs/targets/aarch64-softmmu.c | 18 +++----------
> configs/targets/arm-softmmu.c | 18 +++----------
> page-vary-common.c | 8 ++----
> page-vary-system.c | 6 ++---
> target-info-qom.c | 11 +++-----
> target-info-stub.c | 28 ++++---------------
> target-info.c | 12 ++++-----
> 9 files changed, 65 insertions(+), 92 deletions(-)
>
...
> diff --git a/configs/targets/aarch64-softmmu.c b/configs/targets/aarch64-softmmu.c
> index 75d95b0e74..4f43f3e89a 100644
> --- a/configs/targets/aarch64-softmmu.c
> +++ b/configs/targets/aarch64-softmmu.c
> @@ -7,21 +7,11 @@
> */
>
> #include "qemu/osdep.h"
> -#include "qemu/target-info-impl.h"
> -#include "qemu/target-info-init.h"
> #include "hw/arm/machines-qom.h"
> #include "target/arm/cpu-qom.h"
> #include "target/arm/cpu-param.h"
> +#include "qemu/target-info-impl.h"
> +#include "qemu/target-info-init.h"
>
> -static const TargetInfo target_info_aarch64_system = {
> - .target_name = "aarch64",
> - .target_arch = SYS_EMU_TARGET_AARCH64,
> - .long_bits = 64,
> - .cpu_type = TYPE_ARM_CPU,
> - .machine_typename = TYPE_TARGET_AARCH64_MACHINE,
> - .endianness = ENDIAN_MODE_LITTLE,
> - .page_bits_vary = true,
> - .page_bits_init = TARGET_PAGE_BITS_LEGACY,
> -};
> -
> -target_info_init(target_info_aarch64_system)
> +DEF_TARGET_INFO(target_info_aarch64_system,
> + TYPE_ARM_CPU, TYPE_TARGET_AARCH64_MACHINE)
While it's definitely less code to type, I don't think it's really good
to bury that under yet another macro. Code repetition is not always a
bad thing, as long as it's not code we'll have to modify everyday. Those
definitions will probably never be modified in the future.
In a single grep, developer can directly see the specifics of this
target, without having to guess any header name or refer to another
file. As well, the target_info_init patterns follows the x_init pattern
coming from module_init.
Regards,
Pierrick
next prev parent reply other threads:[~2026-05-12 2:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 19:06 [PATCH 0/5] target_info optimizations Richard Henderson
2026-05-11 19:06 ` [PATCH 1/5] meson: Build target-info-qom.c with -fno-lto Richard Henderson
2026-05-11 19:38 ` Pierrick Bouvier
2026-05-11 20:08 ` Richard Henderson
2026-05-11 19:06 ` [PATCH 2/5] target-info: Expose target_info as const data Richard Henderson
2026-05-12 2:22 ` Pierrick Bouvier [this message]
2026-05-11 19:06 ` [PATCH 3/5] target-info: Merge target-info-impl.h into target-info.h Richard Henderson
2026-05-12 2:25 ` Pierrick Bouvier
2026-05-12 3:20 ` Philippe Mathieu-Daudé
2026-05-11 19:06 ` [PATCH 4/5] target-info: Merge target-info-qapi.h " Richard Henderson
2026-05-12 2:25 ` Pierrick Bouvier
2026-05-11 19:06 ` [PATCH 5/5] target-info: Inline accessors Richard Henderson
2026-05-12 2:26 ` Pierrick Bouvier
2026-05-12 2:14 ` [PATCH 0/5] target_info optimizations 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=28e6ad6e-ef06-4cc3-bf17-c7a880b5e500@oss.qualcomm.com \
--to=pierrick.bouvier@oss.qualcomm.com \
--cc=philmd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.