On Wed, Oct 14, 2026 at 11:10 AM Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> On 13/10/26 21:59, Yonggang Luo wrote:
> > This is for avoid call target_info() in class_init
>
> Why? What is the use case you are you trying to fix?
>
> https://cbea.ms/git-commit/#why-not-how
>
> > Signed-off-by: Yonggang Luo <[email protected]>
> > ---
> >   hw/microblaze/petalogix_s3adsp1800_mmu.c | 11 ++++++++---
> >   1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c 
> > b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> > index c5f64319009..43140ad7bda 100644
> > --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> > +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> > @@ -83,7 +83,13 @@ petalogix_s3adsp1800_init(MachineState *machine)
> >       MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
> >       qemu_irq irq[32];
> >       MemoryRegion *sysmem = get_system_memory();
> > -    EndianMode endianness = psms->endianness;
> > +    EndianMode endianness;
> > +
> > +    if (psms->endianness == ENDIAN_MODE_UNSPECIFIED) {
> > +        psms->endianness = target_big_endian() ? ENDIAN_MODE_BIG :
> > +                                           ENDIAN_MODE_LITTLE;
> > +    }
> > +    endianness = psms->endianness;
> >
> >       cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
> >       object_property_set_str(OBJECT(cpu), "version", "7.10.d", 
> > &error_abort);
> > @@ -178,8 +184,7 @@ static void 
> > petalogix_s3adsp1800_machine_class_init(ObjectClass *oc,
> >                                             &EndianMode_lookup,
> >                                             machine_get_endianness,
> >                                             machine_set_endianness);
> > -    object_property_set_default_str(prop, target_big_endian() ? "big"
> > -                                                              : "little");
> > +    object_property_set_default_str(prop, "unspecified");
> >       object_class_property_set_description(oc, "endianness",
> >               "Defines whether the machine runs in big or little endian 
> > mode");
> >   }
>

https://lore.kernel.org/qemu-devel/[email protected]/

Avoid calling target_info() in class_init, as for the combined
qemu-system, target_info() is not available(NULL)
till the machine is selected.


-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

Reply via email to