From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
Bernhard Beschow <shentey@gmail.com>,
Igor Mammedov <imammedo@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH 1/4] hw/microblaze: Add endianness property to the petalogix_s3adsp1800 machine
Date: Sun, 25 May 2025 21:09:58 +0200 [thread overview]
Message-ID: <9f5fddbd-8989-4549-af89-87a19cb68a19@linaro.org> (raw)
In-Reply-To: <00ec097f-b43a-4831-b4b6-c5d20aac236f@linaro.org>
+Markus
On 24/5/25 13:55, Richard Henderson wrote:
> On 5/15/25 14:20, Thomas Huth wrote:
>> +static int machine_get_endianness(Object *obj, Error **errp
>> G_GNUC_UNUSED)
>> +{
>> + S3Adsp1800MachineState *ms = PETALOGIX_S3ADSP1800_MACHINE(obj);
>> + return ms->endianness;
>> +}
>> +
>> +static void machine_set_endianness(Object *obj, int endianness, Error
>> **errp)
>> +{
>> + S3Adsp1800MachineState *ms = PETALOGIX_S3ADSP1800_MACHINE(obj);
>> + ms->endianness = endianness;
>> +}
>> +
>> static void petalogix_s3adsp1800_machine_class_init(ObjectClass *oc,
>> const void *data)
>> {
>> MachineClass *mc = MACHINE_CLASS(oc);
>> + ObjectProperty *prop;
>> mc->desc = "PetaLogix linux refdesign for xilinx Spartan
>> 3ADSP1800";
>> mc->init = petalogix_s3adsp1800_init;
>> mc->is_default = true;
>> +
>> + prop = object_class_property_add_enum(oc, "endianness",
>> "EndianMode",
>> + &EndianMode_lookup,
>> + machine_get_endianness,
>> + machine_set_endianness);
>> + object_property_set_default_str(prop, TARGET_BIG_ENDIAN ? "big" :
>> "little");
>> + object_class_property_set_description(oc, "endianness",
>> + "Defines whether the machine runs in big or little endian
>> mode");
>
>
> Better with Property? You don't have to write get/set...
>
> static const Property props[] = {
> DEFINE_PROP_ENDIAN("endianness", S3Adsp1800MachineState, endianness,
> TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG :
> ENDIAN_MODE_LITTLE),
> };
>
> device_class_set_props(dc, props);
DEFINE_PROP_FOO() are restricted to QDev (DeviceClass). Here we have
a MachineClass, which only inherits ObjectClass, not DeviceClass.
Markus once explained me the difference between QDev properties
and bare object ones; I asked why we couldn't make qdev properties
generic to objects, but I don't remember the historical rationale.
QDev predates QOM, QDev used static properties, QOM introduced
dynamic ones? We definitively should document that...
next prev parent reply other threads:[~2025-05-25 19:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 13:20 [PATCH 0/4] hw/microblaze: Endianness clean-ups and deprecations Thomas Huth
2025-05-15 13:20 ` [PATCH 1/4] hw/microblaze: Add endianness property to the petalogix_s3adsp1800 machine Thomas Huth
2025-05-24 12:55 ` Richard Henderson
2025-05-25 19:09 ` Philippe Mathieu-Daudé [this message]
2025-05-26 13:51 ` Markus Armbruster
2025-05-27 13:56 ` Philippe Mathieu-Daudé
2025-05-15 13:20 ` [PATCH 2/4] tests/functional: Test both microblaze s3adsp1800 endianness variants Thomas Huth
2025-05-27 13:54 ` Philippe Mathieu-Daudé
2025-05-15 13:20 ` [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu Thomas Huth
2025-05-16 15:00 ` Philippe Mathieu-Daudé
2025-05-16 15:06 ` Thomas Huth
2025-05-25 19:19 ` Philippe Mathieu-Daudé
2025-05-26 5:59 ` Thomas Huth
2025-05-24 12:56 ` Richard Henderson
2025-05-27 13:51 ` Philippe Mathieu-Daudé
2025-05-15 13:20 ` [PATCH 4/4] docs: Deprecate the qemu-system-microblazeel binary Thomas Huth
2025-05-24 12:57 ` Richard Henderson
2025-05-27 13:50 ` 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=9f5fddbd-8989-4549-af89-87a19cb68a19@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
--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).