qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ppc: Fixes for class and instance size problems
@ 2020-08-25 11:16 David Gibson
  2020-08-25 11:16 ` [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE David Gibson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: David Gibson @ 2020-08-25 11:16 UTC (permalink / raw)
  To: ehabkost; +Cc: qemu-ppc, qemu-devel, David Gibson

As requested, some fixes for the ppc things found by Eduardo's
scripts.

Cédric Le Goater (1):
  ppc/pnv: Fix TypeInfo of PnvLpcController abstract class

David Gibson (2):
  adb: Correct class size on TYPE_ADB_DEVICE
  spapr: Correct type for SPAPR_DRC_PCI

 hw/input/adb.c             | 1 +
 hw/ppc/pnv_lpc.c           | 3 +--
 include/hw/ppc/spapr_drc.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE
  2020-08-25 11:16 [PATCH 0/3] ppc: Fixes for class and instance size problems David Gibson
@ 2020-08-25 11:16 ` David Gibson
  2020-09-01  9:56   ` Philippe Mathieu-Daudé
  2020-08-25 11:16 ` [PATCH 2/3] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class David Gibson
  2020-08-25 11:16 ` [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI David Gibson
  2 siblings, 1 reply; 8+ messages in thread
From: David Gibson @ 2020-08-25 11:16 UTC (permalink / raw)
  To: ehabkost; +Cc: qemu-ppc, qemu-devel, David Gibson

The TypeInfo incorrectly just lets the class size be inherited.  It won't
actually break things, since the class is abstract, but we should get it
right.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/input/adb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index 013fcc9c54..84331b9fce 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -309,6 +309,7 @@ static void adb_device_class_init(ObjectClass *oc, void *data)
 static const TypeInfo adb_device_type_info = {
     .name = TYPE_ADB_DEVICE,
     .parent = TYPE_DEVICE,
+    .class_size = sizeof(ADBDeviceClass),
     .instance_size = sizeof(ADBDevice),
     .abstract = true,
     .class_init = adb_device_class_init,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class
  2020-08-25 11:16 [PATCH 0/3] ppc: Fixes for class and instance size problems David Gibson
  2020-08-25 11:16 ` [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE David Gibson
@ 2020-08-25 11:16 ` David Gibson
  2020-09-01  9:56   ` Philippe Mathieu-Daudé
  2020-08-25 11:16 ` [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI David Gibson
  2 siblings, 1 reply; 8+ messages in thread
From: David Gibson @ 2020-08-25 11:16 UTC (permalink / raw)
  To: ehabkost; +Cc: David Gibson, qemu-ppc, qemu-devel, Cédric Le Goater

From: Cédric Le Goater <clg@kaod.org>

It was missing the instance_size field.

Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20200822083920.2668930-1-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/pnv_lpc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index b5ffa48dac..23f1e09492 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -646,7 +646,6 @@ static void pnv_lpc_power8_class_init(ObjectClass *klass, void *data)
 static const TypeInfo pnv_lpc_power8_info = {
     .name          = TYPE_PNV8_LPC,
     .parent        = TYPE_PNV_LPC,
-    .instance_size = sizeof(PnvLpcController),
     .class_init    = pnv_lpc_power8_class_init,
     .interfaces = (InterfaceInfo[]) {
         { TYPE_PNV_XSCOM_INTERFACE },
@@ -687,7 +686,6 @@ static void pnv_lpc_power9_class_init(ObjectClass *klass, void *data)
 static const TypeInfo pnv_lpc_power9_info = {
     .name          = TYPE_PNV9_LPC,
     .parent        = TYPE_PNV_LPC,
-    .instance_size = sizeof(PnvLpcController),
     .class_init    = pnv_lpc_power9_class_init,
 };
 
@@ -768,6 +766,7 @@ static void pnv_lpc_class_init(ObjectClass *klass, void *data)
 static const TypeInfo pnv_lpc_info = {
     .name          = TYPE_PNV_LPC,
     .parent        = TYPE_DEVICE,
+    .instance_size = sizeof(PnvLpcController),
     .class_init    = pnv_lpc_class_init,
     .class_size    = sizeof(PnvLpcClass),
     .abstract      = true,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI
  2020-08-25 11:16 [PATCH 0/3] ppc: Fixes for class and instance size problems David Gibson
  2020-08-25 11:16 ` [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE David Gibson
  2020-08-25 11:16 ` [PATCH 2/3] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class David Gibson
@ 2020-08-25 11:16 ` David Gibson
  2020-08-26 16:21   ` Eduardo Habkost
  2 siblings, 1 reply; 8+ messages in thread
From: David Gibson @ 2020-08-25 11:16 UTC (permalink / raw)
  To: ehabkost; +Cc: qemu-ppc, qemu-devel, David Gibson

TYPE_SPAPR_DRC_PCI inherits from TYPE_SPAPR_DRC_PHYSICAL, so its checker
macro should use the corresponding instance type.  We got away with it
because we never actually used that checker macro.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 include/hw/ppc/spapr_drc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
index 21af8deac1..baaaba3c1f 100644
--- a/include/hw/ppc/spapr_drc.h
+++ b/include/hw/ppc/spapr_drc.h
@@ -59,7 +59,7 @@
         OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PCI)
 #define SPAPR_DRC_PCI_CLASS(klass) \
         OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PCI)
-#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrc, (obj), \
+#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrcPhysical, (obj), \
                                         TYPE_SPAPR_DRC_PCI)
 
 #define TYPE_SPAPR_DRC_LMB "spapr-drc-lmb"
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI
  2020-08-25 11:16 ` [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI David Gibson
@ 2020-08-26 16:21   ` Eduardo Habkost
  2020-08-31 23:52     ` David Gibson
  0 siblings, 1 reply; 8+ messages in thread
From: Eduardo Habkost @ 2020-08-26 16:21 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel

On Tue, Aug 25, 2020 at 09:16:27PM +1000, David Gibson wrote:
> TYPE_SPAPR_DRC_PCI inherits from TYPE_SPAPR_DRC_PHYSICAL, so its checker
> macro should use the corresponding instance type.  We got away with it
> because we never actually used that checker macro.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  include/hw/ppc/spapr_drc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
> index 21af8deac1..baaaba3c1f 100644
> --- a/include/hw/ppc/spapr_drc.h
> +++ b/include/hw/ppc/spapr_drc.h
> @@ -59,7 +59,7 @@
>          OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PCI)
>  #define SPAPR_DRC_PCI_CLASS(klass) \
>          OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PCI)
> -#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrc, (obj), \
> +#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrcPhysical, (obj), \
>                                          TYPE_SPAPR_DRC_PCI)

I'm not sure this is really what we want to do.  This is what
triggered the warning in my script, but it doesn't mean we want
to use SpaprDrcPhysical here.

Code that needs a SpaprDrc* can use SPAPR_DR_CONNECTOR();
code that needs a SpaprDrcPhysical* can use SPAPR_DRC_PHYSICAL().
All the other OBJECT_CHECK(SpaprDrc, ...) and
OBJECT_CHECK(SpaprDrcPhysical, ...) macros seem unnecessary.

-- 
Eduardo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI
  2020-08-26 16:21   ` Eduardo Habkost
@ 2020-08-31 23:52     ` David Gibson
  0 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2020-08-31 23:52 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: qemu-ppc, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]

On Wed, Aug 26, 2020 at 12:21:37PM -0400, Eduardo Habkost wrote:
> On Tue, Aug 25, 2020 at 09:16:27PM +1000, David Gibson wrote:
> > TYPE_SPAPR_DRC_PCI inherits from TYPE_SPAPR_DRC_PHYSICAL, so its checker
> > macro should use the corresponding instance type.  We got away with it
> > because we never actually used that checker macro.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  include/hw/ppc/spapr_drc.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
> > index 21af8deac1..baaaba3c1f 100644
> > --- a/include/hw/ppc/spapr_drc.h
> > +++ b/include/hw/ppc/spapr_drc.h
> > @@ -59,7 +59,7 @@
> >          OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PCI)
> >  #define SPAPR_DRC_PCI_CLASS(klass) \
> >          OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PCI)
> > -#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrc, (obj), \
> > +#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrcPhysical, (obj), \
> >                                          TYPE_SPAPR_DRC_PCI)
> 
> I'm not sure this is really what we want to do.  This is what
> triggered the warning in my script, but it doesn't mean we want
> to use SpaprDrcPhysical here.
> 
> Code that needs a SpaprDrc* can use SPAPR_DR_CONNECTOR();
> code that needs a SpaprDrcPhysical* can use SPAPR_DRC_PHYSICAL().
> All the other OBJECT_CHECK(SpaprDrc, ...) and
> OBJECT_CHECK(SpaprDrcPhysical, ...) macros seem unnecessary.

Good point.  I've rewritten and am resending.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE
  2020-08-25 11:16 ` [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE David Gibson
@ 2020-09-01  9:56   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-01  9:56 UTC (permalink / raw)
  To: David Gibson, ehabkost; +Cc: qemu-ppc, qemu-devel

On 8/25/20 1:16 PM, David Gibson wrote:
> The TypeInfo incorrectly just lets the class size be inherited.  It won't
> actually break things, since the class is abstract, but we should get it
> right.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  hw/input/adb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index 013fcc9c54..84331b9fce 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -309,6 +309,7 @@ static void adb_device_class_init(ObjectClass *oc, void *data)
>  static const TypeInfo adb_device_type_info = {
>      .name = TYPE_ADB_DEVICE,
>      .parent = TYPE_DEVICE,
> +    .class_size = sizeof(ADBDeviceClass),
>      .instance_size = sizeof(ADBDevice),
>      .abstract = true,
>      .class_init = adb_device_class_init,
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class
  2020-08-25 11:16 ` [PATCH 2/3] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class David Gibson
@ 2020-09-01  9:56   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-01  9:56 UTC (permalink / raw)
  To: David Gibson, ehabkost; +Cc: qemu-ppc, qemu-devel, Cédric Le Goater

On 8/25/20 1:16 PM, David Gibson wrote:
> From: Cédric Le Goater <clg@kaod.org>
> 
> It was missing the instance_size field.
> 
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> Message-Id: <20200822083920.2668930-1-clg@kaod.org>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  hw/ppc/pnv_lpc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
> index b5ffa48dac..23f1e09492 100644
> --- a/hw/ppc/pnv_lpc.c
> +++ b/hw/ppc/pnv_lpc.c
> @@ -646,7 +646,6 @@ static void pnv_lpc_power8_class_init(ObjectClass *klass, void *data)
>  static const TypeInfo pnv_lpc_power8_info = {
>      .name          = TYPE_PNV8_LPC,
>      .parent        = TYPE_PNV_LPC,
> -    .instance_size = sizeof(PnvLpcController),
>      .class_init    = pnv_lpc_power8_class_init,
>      .interfaces = (InterfaceInfo[]) {
>          { TYPE_PNV_XSCOM_INTERFACE },
> @@ -687,7 +686,6 @@ static void pnv_lpc_power9_class_init(ObjectClass *klass, void *data)
>  static const TypeInfo pnv_lpc_power9_info = {
>      .name          = TYPE_PNV9_LPC,
>      .parent        = TYPE_PNV_LPC,
> -    .instance_size = sizeof(PnvLpcController),
>      .class_init    = pnv_lpc_power9_class_init,
>  };
>  
> @@ -768,6 +766,7 @@ static void pnv_lpc_class_init(ObjectClass *klass, void *data)
>  static const TypeInfo pnv_lpc_info = {
>      .name          = TYPE_PNV_LPC,
>      .parent        = TYPE_DEVICE,
> +    .instance_size = sizeof(PnvLpcController),
>      .class_init    = pnv_lpc_class_init,
>      .class_size    = sizeof(PnvLpcClass),
>      .abstract      = true,
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-01 10:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 11:16 [PATCH 0/3] ppc: Fixes for class and instance size problems David Gibson
2020-08-25 11:16 ` [PATCH 1/3] adb: Correct class size on TYPE_ADB_DEVICE David Gibson
2020-09-01  9:56   ` Philippe Mathieu-Daudé
2020-08-25 11:16 ` [PATCH 2/3] ppc/pnv: Fix TypeInfo of PnvLpcController abstract class David Gibson
2020-09-01  9:56   ` Philippe Mathieu-Daudé
2020-08-25 11:16 ` [PATCH 3/3] spapr: Correct type for SPAPR_DRC_PCI David Gibson
2020-08-26 16:21   ` Eduardo Habkost
2020-08-31 23:52     ` David Gibson

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).