From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Pierrick Bouvier <pierrick.bouvier@linaro.org>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [RFC PATCH 01/11] system: Extract target-specific globals to their own compilation unit
Date: Wed, 5 Mar 2025 02:33:53 +0100 [thread overview]
Message-ID: <a11bfca2-5ffc-49b4-94fa-e5d466bc56bf@linaro.org> (raw)
In-Reply-To: <539de40b-de27-4781-bcb0-46986fc2f28f@linaro.org>
On 5/3/25 02:20, Pierrick Bouvier wrote:
> On 3/4/25 16:52, Philippe Mathieu-Daudé wrote:
>> We shouldn't use target specific globals for machine properties.
>> These ones could be desugarized, as explained in [*]. While
>> certainly doable, not trivial nor my priority for now. Just move
>> them to a different file to clarify they are *globals*, like the
>> generic globals residing in system/globals.c.
>>
>
> Maybe those could be set globally to the default:
> int graphic_width = 800;
> int graphic_height = 600;
> int graphic_depth = 32;
>
> And override them for sparc and m68k in qemu_init_arch_modules function,
> using qemu_arch_name().
> This way, no need to have a new file to hold them.
This is not what Paolo explained ...
>
>> [*] https://lore.kernel.org/qemu-devel/e514d6db-781d-4afe-
>> b057-9046c70044dc@redhat.com/
... here ^, but maybe I misunderstood him.
Doing the '-g' CLI change is not my priority, and I welcome
any developer willing to help :) Here I'm just trying to make
sense of that arch_init.c file.
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> system/arch_init.c | 14 --------------
>> system/globals-target.c | 24 ++++++++++++++++++++++++
>> system/meson.build | 1 +
>> 3 files changed, 25 insertions(+), 14 deletions(-)
>> create mode 100644 system/globals-target.c
>>
>> diff --git a/system/arch_init.c b/system/arch_init.c
>> index d2c32f84887..ea0842b7410 100644
>> --- a/system/arch_init.c
>> +++ b/system/arch_init.c
>> @@ -25,20 +25,6 @@
>> #include "qemu/module.h"
>> #include "system/arch_init.h"
>> -#ifdef TARGET_SPARC
>> -int graphic_width = 1024;
>> -int graphic_height = 768;
>> -int graphic_depth = 8;
>> -#elif defined(TARGET_M68K)
>> -int graphic_width = 800;
>> -int graphic_height = 600;
>> -int graphic_depth = 8;
>> -#else
>> -int graphic_width = 800;
>> -int graphic_height = 600;
>> -int graphic_depth = 32;
>> -#endif
>> -
>> const uint32_t arch_type = QEMU_ARCH;
>> void qemu_init_arch_modules(void)
>> diff --git a/system/globals-target.c b/system/globals-target.c
>> new file mode 100644
>> index 00000000000..989720591e7
>> --- /dev/null
>> +++ b/system/globals-target.c
>> @@ -0,0 +1,24 @@
>> +/*
>> + * Global variables that should not exist (target specific)
>> + *
>> + * Copyright (c) 2003-2008 Fabrice Bellard
>> + *
>> + * SPDX-License-Identifier: MIT
>> + */
>> +
>> +#include "qemu/osdep.h"
>> +#include "system/system.h"
>> +
>> +#ifdef TARGET_SPARC
>> +int graphic_width = 1024;
>> +int graphic_height = 768;
>> +int graphic_depth = 8;
>> +#elif defined(TARGET_M68K)
>> +int graphic_width = 800;
>> +int graphic_height = 600;
>> +int graphic_depth = 8;
>> +#else
>> +int graphic_width = 800;
>> +int graphic_height = 600;
>> +int graphic_depth = 32;
>> +#endif
>> diff --git a/system/meson.build b/system/meson.build
>> index 4952f4b2c7d..181195410fb 100644
>> --- a/system/meson.build
>> +++ b/system/meson.build
>> @@ -1,6 +1,7 @@
>> specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
>> 'arch_init.c',
>> 'ioport.c',
>> + 'globals-target.c',
>> 'memory.c',
>> 'physmem.c',
>> 'watchpoint.c',
>
next prev parent reply other threads:[~2025-03-05 1:35 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 0:52 [RFC PATCH 00/11] qemu: Remove TARGET_NAME definition Philippe Mathieu-Daudé
2025-03-05 0:52 ` [RFC PATCH 01/11] system: Extract target-specific globals to their own compilation unit Philippe Mathieu-Daudé
2025-03-05 1:20 ` Pierrick Bouvier
2025-03-05 1:33 ` Philippe Mathieu-Daudé [this message]
2025-03-05 1:41 ` Pierrick Bouvier
2025-03-11 10:24 ` Alex Bennée
2025-03-05 0:52 ` [RFC PATCH 02/11] system: Open-code qemu_init_arch_modules() using target_name() Philippe Mathieu-Daudé
2025-03-05 2:27 ` Richard Henderson
2025-03-05 0:52 ` [RFC PATCH 03/11] system: Introduce QemuArchBit enum Philippe Mathieu-Daudé
2025-03-05 1:23 ` Pierrick Bouvier
2025-03-05 1:31 ` Philippe Mathieu-Daudé
2025-03-05 1:36 ` Pierrick Bouvier
2025-03-05 1:39 ` Philippe Mathieu-Daudé
2025-03-05 2:27 ` Richard Henderson
2025-03-05 8:55 ` Daniel P. Berrangé
2025-03-05 9:00 ` Daniel P. Berrangé
2025-03-05 0:52 ` [RFC PATCH 04/11] system: Replace arch_type global by qemu_arch_available() helper Philippe Mathieu-Daudé
2025-03-05 2:29 ` Richard Henderson
2025-03-05 0:52 ` [RFC PATCH 05/11] include: Expose QemuArchBit enum to user emulation Philippe Mathieu-Daudé
2025-03-05 2:43 ` Richard Henderson
2025-03-05 0:52 ` [RFC PATCH 06/11] include: Declare target_name() in common "qemu/arch_info.h" Philippe Mathieu-Daudé
2025-03-05 2:44 ` Richard Henderson
2025-03-05 0:52 ` [RFC PATCH 07/11] plugins/loader: populate target_name with target_name() Philippe Mathieu-Daudé
2025-03-05 0:52 ` [RFC PATCH 08/11] tests/qtest: Replace TARGET_NAME -> target_name() Philippe Mathieu-Daudé
2025-03-05 3:02 ` Richard Henderson
2025-03-05 0:52 ` [RFC PATCH 09/11] user: " Philippe Mathieu-Daudé
2025-03-05 0:52 ` [RFC PATCH 10/11] qemu: Introduce qemu_arch_name() helper Philippe Mathieu-Daudé
2025-03-05 1:32 ` BALATON Zoltan
2025-03-05 1:36 ` Philippe Mathieu-Daudé
2025-03-05 2:05 ` BALATON Zoltan
2025-03-05 2:23 ` Richard Henderson
2025-03-05 8:59 ` Daniel P. Berrangé
2025-03-05 0:52 ` [RFC PATCH 11/11] qemu: Remove C definitions of TARGET_NAME Philippe Mathieu-Daudé
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=a11bfca2-5ffc-49b4-94fa-e5d466bc56bf@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/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).