Message ID | 20230203145536.17585-13-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw: Use QOM alias properties and few QOM/QDev cleanups | expand |
On Fri, 3 Feb 2023, Philippe Mathieu-Daudé wrote: > Since now PCI and SysBus properties are identical, unify them. > > Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> > --- > hw/display/sm501.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/hw/display/sm501.c b/hw/display/sm501.c > index efebd93f1e..98375138b2 100644 > --- a/hw/display/sm501.c > +++ b/hw/display/sm501.c > @@ -1975,7 +1975,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) > /* TODO : chain irq to IRL */ > } > > -static Property sm501_sysbus_properties[] = { > +static Property sm501_common_properties[] = { > DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), > DEFINE_PROP_END_OF_LIST(), > }; > @@ -2004,7 +2004,7 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data) > dc->realize = sm501_realize_sysbus; > set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); > dc->desc = "SM501 Multimedia Companion"; > - device_class_set_props(dc, sm501_sysbus_properties); > + device_class_set_props(dc, sm501_common_properties); > dc->reset = sm501_reset_sysbus; > dc->vmsd = &vmstate_sm501_sysbus; > } > @@ -2062,11 +2062,6 @@ static void sm501_realize_pci(PCIDevice *dev, Error **errp) > &s->state.mmio_region); > } > > -static Property sm501_pci_properties[] = { > - DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), > - DEFINE_PROP_END_OF_LIST(), > -}; > - > static void sm501_reset_pci(DeviceState *dev) > { > SM501PCIState *s = PCI_SM501(dev); > @@ -2098,7 +2093,7 @@ static void sm501_pci_class_init(ObjectClass *klass, void *data) > k->class_id = PCI_CLASS_DISPLAY_OTHER; > set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); > dc->desc = "SM501 Display Controller"; > - device_class_set_props(dc, sm501_pci_properties); > + device_class_set_props(dc, sm501_common_properties); > dc->reset = sm501_reset_pci; > dc->hotpluggable = false; > dc->vmsd = &vmstate_sm501_pci; >
On 3/2/23 15:55, Philippe Mathieu-Daudé wrote: > Since now PCI and SysBus properties are identical, unify them. > > Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/display/sm501.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/hw/display/sm501.c b/hw/display/sm501.c > index efebd93f1e..98375138b2 100644 > --- a/hw/display/sm501.c > +++ b/hw/display/sm501.c > @@ -1975,7 +1975,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) > /* TODO : chain irq to IRL */ > } > > -static Property sm501_sysbus_properties[] = { > +static Property sm501_common_properties[] = { > DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), > DEFINE_PROP_END_OF_LIST(), > }; > @@ -2062,11 +2062,6 @@ static void sm501_realize_pci(PCIDevice *dev, Error **errp) > &s->state.mmio_region); > } > > -static Property sm501_pci_properties[] = { > - DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), Patch is invalid: $ ./qemu-system-ppc -S -M sam460ex qemu-system-ppc: Invalid VRAM size, nearest valid size is 2097152 > - DEFINE_PROP_END_OF_LIST(), > -};
On Mon, 27 Feb 2023, Philippe Mathieu-Daudé wrote: > On 3/2/23 15:55, Philippe Mathieu-Daudé wrote: >> Since now PCI and SysBus properties are identical, unify them. >> >> Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> hw/display/sm501.c | 11 +++-------- >> 1 file changed, 3 insertions(+), 8 deletions(-) >> >> diff --git a/hw/display/sm501.c b/hw/display/sm501.c >> index efebd93f1e..98375138b2 100644 >> --- a/hw/display/sm501.c >> +++ b/hw/display/sm501.c >> @@ -1975,7 +1975,7 @@ static void sm501_realize_sysbus(DeviceState *dev, >> Error **errp) >> /* TODO : chain irq to IRL */ >> } >> -static Property sm501_sysbus_properties[] = { >> +static Property sm501_common_properties[] = { >> DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), >> DEFINE_PROP_END_OF_LIST(), >> }; > > >> @@ -2062,11 +2062,6 @@ static void sm501_realize_pci(PCIDevice *dev, Error >> **errp) >> &s->state.mmio_region); >> } >> -static Property sm501_pci_properties[] = { >> - DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), Oops, indeed the defaults are different so maybe just drop this patch for now. Regards, BALATON Zoltan > > Patch is invalid: > > $ ./qemu-system-ppc -S -M sam460ex > qemu-system-ppc: Invalid VRAM size, nearest valid size is 2097152 > >> - DEFINE_PROP_END_OF_LIST(), >> -}; > > > >
BALATON Zoltan <balaton@eik.bme.hu> writes: > On Mon, 27 Feb 2023, Philippe Mathieu-Daudé wrote: >> On 3/2/23 15:55, Philippe Mathieu-Daudé wrote: >>> Since now PCI and SysBus properties are identical, unify them. >>> Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> >>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >>> --- >>> hw/display/sm501.c | 11 +++-------- >>> 1 file changed, 3 insertions(+), 8 deletions(-) >>> diff --git a/hw/display/sm501.c b/hw/display/sm501.c >>> index efebd93f1e..98375138b2 100644 >>> --- a/hw/display/sm501.c >>> +++ b/hw/display/sm501.c >>> @@ -1975,7 +1975,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) >>> /* TODO : chain irq to IRL */ >>> } >>> -static Property sm501_sysbus_properties[] = { >>> +static Property sm501_common_properties[] = { >>> DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), >>> DEFINE_PROP_END_OF_LIST(), >>> }; >> >> >>> @@ -2062,11 +2062,6 @@ static void sm501_realize_pci(PCIDevice *dev, Error **errp) >>> &s->state.mmio_region); >>> } >>> -static Property sm501_pci_properties[] = { >>> - DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), > > Oops, indeed the defaults are different so maybe just drop this patch for now. Okay, I'm ignoring this patch.
diff --git a/hw/display/sm501.c b/hw/display/sm501.c index efebd93f1e..98375138b2 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1975,7 +1975,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) /* TODO : chain irq to IRL */ } -static Property sm501_sysbus_properties[] = { +static Property sm501_common_properties[] = { DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), DEFINE_PROP_END_OF_LIST(), }; @@ -2004,7 +2004,7 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data) dc->realize = sm501_realize_sysbus; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->desc = "SM501 Multimedia Companion"; - device_class_set_props(dc, sm501_sysbus_properties); + device_class_set_props(dc, sm501_common_properties); dc->reset = sm501_reset_sysbus; dc->vmsd = &vmstate_sm501_sysbus; } @@ -2062,11 +2062,6 @@ static void sm501_realize_pci(PCIDevice *dev, Error **errp) &s->state.mmio_region); } -static Property sm501_pci_properties[] = { - DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), - DEFINE_PROP_END_OF_LIST(), -}; - static void sm501_reset_pci(DeviceState *dev) { SM501PCIState *s = PCI_SM501(dev); @@ -2098,7 +2093,7 @@ static void sm501_pci_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_DISPLAY_OTHER; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->desc = "SM501 Display Controller"; - device_class_set_props(dc, sm501_pci_properties); + device_class_set_props(dc, sm501_common_properties); dc->reset = sm501_reset_pci; dc->hotpluggable = false; dc->vmsd = &vmstate_sm501_pci;
Since now PCI and SysBus properties are identical, unify them. Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/display/sm501.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)