Message ID | 20221209151533.69516-6-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw/mips: Make gt64xxx_pci.c endian-agnostic | expand |
On 12/9/22 07:15, Philippe Mathieu-Daudé wrote: > Propagate the controller endianess from the machine, setting > the "cpu-little-endian" property. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/mips/malta.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Modulo using qdev_prop_set_bool, Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~ > > diff --git a/hw/mips/malta.c b/hw/mips/malta.c > index ba92022f87..1f4e0c7acc 100644 > --- a/hw/mips/malta.c > +++ b/hw/mips/malta.c > @@ -1390,7 +1390,9 @@ void mips_malta_init(MachineState *machine) > stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); > > /* Northbridge */ > - dev = sysbus_create_simple("gt64120", -1, NULL); > + dev = qdev_new("gt64120"); > + qdev_prop_set_bit(dev, "cpu-little-endian", !be); > + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); > pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); > > /* Southbridge */
+Eduardo/Markus for QOM/QDEV clarification. On 20/12/22 01:52, Richard Henderson wrote: > On 12/9/22 07:15, Philippe Mathieu-Daudé wrote: >> Propagate the controller endianess from the machine, setting >> the "cpu-little-endian" property. >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> hw/mips/malta.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) > > Modulo using qdev_prop_set_bool, Surprisingly there is no qdev_prop_set_bool()... I can use the QOM layer with object_property_add_bool(), i.e.: $ git grep memory-hotplug-support hw/acpi/ich9.c:451: object_property_add_bool(obj, "memory-hotplug-support", hw/acpi/piix4.c:608: DEFINE_PROP_BOOL("memory-hotplug-support", PIIX4PMState, But I notice some qdev_prop_set_bit() uses, i.e. in hw/arm/: $ git grep enable-bitband hw/arm/armv7m.c:528: DEFINE_PROP_BOOL("enable-bitband", ARMv7MState, enable_bitband, false), hw/arm/mps2.c:242: qdev_prop_set_bit(armv7m, "enable-bitband", true); hw/arm/msf2-soc.c:138: qdev_prop_set_bit(armv7m, "enable-bitband", true); hw/arm/stellaris.c:1070: qdev_prop_set_bit(nvic, "enable-bitband", true); hw/arm/stm32f100_soc.c:119: qdev_prop_set_bit(armv7m, "enable-bitband", true); In that case this patch doesn't require any change. > Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Thanks! >> >> diff --git a/hw/mips/malta.c b/hw/mips/malta.c >> index ba92022f87..1f4e0c7acc 100644 >> --- a/hw/mips/malta.c >> +++ b/hw/mips/malta.c >> @@ -1390,7 +1390,9 @@ void mips_malta_init(MachineState *machine) >> stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); >> /* Northbridge */ >> - dev = sysbus_create_simple("gt64120", -1, NULL); >> + dev = qdev_new("gt64120"); >> + qdev_prop_set_bit(dev, "cpu-little-endian", !be); >> + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); >> pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); >> /* Southbridge */ >
On 20/12/22 09:30, Philippe Mathieu-Daudé wrote: > +Eduardo/Markus for QOM/QDEV clarification. > > On 20/12/22 01:52, Richard Henderson wrote: >> On 12/9/22 07:15, Philippe Mathieu-Daudé wrote: >>> Propagate the controller endianess from the machine, setting >>> the "cpu-little-endian" property. >>> >>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >>> --- >>> hw/mips/malta.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> Modulo using qdev_prop_set_bool, > > Surprisingly there is no qdev_prop_set_bool()... I can use the QOM layer > with object_property_add_bool(), i.e.: > > $ git grep memory-hotplug-support > hw/acpi/ich9.c:451: object_property_add_bool(obj, > "memory-hotplug-support", > hw/acpi/piix4.c:608: DEFINE_PROP_BOOL("memory-hotplug-support", > PIIX4PMState, Oops I meant: $ git grep reset-hivecs hw/arm/digic.c:55: if (!object_property_set_bool(OBJECT(&s->cpu), "reset-hivecs", true, hw/arm/npcm7xx.c:469: object_property_set_bool(OBJECT(&s->cpu[i]), "reset-hivecs", true, hw/arm/xlnx-zynqmp.c:246: object_property_set_bool(OBJECT(&s->rpu_cpu[i]), "reset-hivecs", true, target/arm/cpu.c:1245: DEFINE_PROP_BOOL("reset-hivecs", ARMCPU, reset_hivecs, false); > But I notice some qdev_prop_set_bit() uses, i.e. in hw/arm/: > > $ git grep enable-bitband > hw/arm/armv7m.c:528: DEFINE_PROP_BOOL("enable-bitband", ARMv7MState, > enable_bitband, false), > hw/arm/mps2.c:242: qdev_prop_set_bit(armv7m, "enable-bitband", true); > hw/arm/msf2-soc.c:138: qdev_prop_set_bit(armv7m, "enable-bitband", > true); > hw/arm/stellaris.c:1070: qdev_prop_set_bit(nvic, "enable-bitband", > true); > hw/arm/stm32f100_soc.c:119: qdev_prop_set_bit(armv7m, > "enable-bitband", true); > > In that case this patch doesn't require any change. I'll keep qdev_prop_set_bit() which is simpler. >> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> > > Thanks! > >>> >>> diff --git a/hw/mips/malta.c b/hw/mips/malta.c >>> index ba92022f87..1f4e0c7acc 100644 >>> --- a/hw/mips/malta.c >>> +++ b/hw/mips/malta.c >>> @@ -1390,7 +1390,9 @@ void mips_malta_init(MachineState *machine) >>> stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); >>> /* Northbridge */ >>> - dev = sysbus_create_simple("gt64120", -1, NULL); >>> + dev = qdev_new("gt64120"); >>> + qdev_prop_set_bit(dev, "cpu-little-endian", !be); >>> + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); >>> pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); >>> /* Southbridge */ >> >
diff --git a/hw/mips/malta.c b/hw/mips/malta.c index ba92022f87..1f4e0c7acc 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1390,7 +1390,9 @@ void mips_malta_init(MachineState *machine) stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); /* Northbridge */ - dev = sysbus_create_simple("gt64120", -1, NULL); + dev = qdev_new("gt64120"); + qdev_prop_set_bit(dev, "cpu-little-endian", !be); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); /* Southbridge */
Propagate the controller endianess from the machine, setting the "cpu-little-endian" property. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/mips/malta.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)