* [PATCH v2 0/2] hw/isa/superio: Clean suspicious QOM types
@ 2020-08-22 14:28 Philippe Mathieu-Daudé
2020-08-22 14:28 ` [PATCH v2 1/2] hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size Philippe Mathieu-Daudé
2020-08-22 14:28 ` [PATCH v2 2/2] hw/isa/superio: Do not enforce class_size when inherited from parent Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-08-22 14:28 UTC (permalink / raw)
To: qemu-devel
Cc: Michael S. Tsirkin, Jiaxun Yang, Aleksandar Markovic,
Paolo Bonzini, Huacai Chen, Philippe Mathieu-Daudé,
Richard Henderson
Fix SuperI/O QOM issues reported here:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg731954.html
Supersedes: <20200821173831.1262979-1-philmd@redhat.com>
Eduardo Habkost (1):
hw/isa/superio: Do not enforce class_size when inherited from parent
Philippe Mathieu-Daudé (1):
hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size
hw/isa/isa-superio.c | 2 +-
hw/isa/smc37c669-superio.c | 2 --
hw/isa/vt82c686.c | 2 --
3 files changed, 1 insertion(+), 5 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size
2020-08-22 14:28 [PATCH v2 0/2] hw/isa/superio: Clean suspicious QOM types Philippe Mathieu-Daudé
@ 2020-08-22 14:28 ` Philippe Mathieu-Daudé
2020-08-26 16:27 ` Eduardo Habkost
2020-08-22 14:28 ` [PATCH v2 2/2] hw/isa/superio: Do not enforce class_size when inherited from parent Philippe Mathieu-Daudé
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-08-22 14:28 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Michael S. Tsirkin, Jiaxun Yang,
Aleksandar Markovic, Paolo Bonzini, Huacai Chen,
Philippe Mathieu-Daudé, Richard Henderson
Instead of setting the instance size on each implementations,
set it on the abstract parent, so we are sure no implementation
will forget to set it.
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/isa/isa-superio.c | 2 +-
hw/isa/smc37c669-superio.c | 1 -
hw/isa/vt82c686.c | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index e2e47d8fd99..83eb21ebb2a 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -182,6 +182,7 @@ static const TypeInfo isa_superio_type_info = {
.name = TYPE_ISA_SUPERIO,
.parent = TYPE_ISA_DEVICE,
.abstract = true,
+ .instance_size = sizeof(ISASuperIODevice),
.class_size = sizeof(ISASuperIOClass),
.class_init = isa_superio_class_init,
};
@@ -200,7 +201,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void *data)
static const TypeInfo fdc37m81x_type_info = {
.name = TYPE_FDC37M81X_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .instance_size = sizeof(ISASuperIODevice),
.class_init = fdc37m81x_class_init,
};
diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c
index 18287741cb4..9e59dc16039 100644
--- a/hw/isa/smc37c669-superio.c
+++ b/hw/isa/smc37c669-superio.c
@@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
static const TypeInfo smc37c669_type_info = {
.name = TYPE_SMC37C669_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .instance_size = sizeof(ISASuperIODevice),
.class_size = sizeof(ISASuperIOClass),
.class_init = smc37c669_class_init,
};
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 18160ca445d..a4b84d405d0 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -533,7 +533,6 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data)
static const TypeInfo via_superio_info = {
.name = TYPE_VT82C686B_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .instance_size = sizeof(ISASuperIODevice),
.class_size = sizeof(ISASuperIOClass),
.class_init = vt82c686b_superio_class_init,
};
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] hw/isa/superio: Do not enforce class_size when inherited from parent
2020-08-22 14:28 [PATCH v2 0/2] hw/isa/superio: Clean suspicious QOM types Philippe Mathieu-Daudé
2020-08-22 14:28 ` [PATCH v2 1/2] hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size Philippe Mathieu-Daudé
@ 2020-08-22 14:28 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-08-22 14:28 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Michael S. Tsirkin, Jiaxun Yang,
Aleksandar Markovic, Paolo Bonzini, Huacai Chen,
Philippe Mathieu-Daudé, Richard Henderson
From: Eduardo Habkost <ehabkost@redhat.com>
When a class inherits from an abstract parent, its class_size
is already initialized to its parent size. If the class is not
extended, it is pointless to set the class_size field again.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/isa/smc37c669-superio.c | 1 -
hw/isa/vt82c686.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c
index 9e59dc16039..18cdc641e13 100644
--- a/hw/isa/smc37c669-superio.c
+++ b/hw/isa/smc37c669-superio.c
@@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
static const TypeInfo smc37c669_type_info = {
.name = TYPE_SMC37C669_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .class_size = sizeof(ISASuperIOClass),
.class_init = smc37c669_class_init,
};
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index a4b84d405d0..49f2b21cebe 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -533,7 +533,6 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data)
static const TypeInfo via_superio_info = {
.name = TYPE_VT82C686B_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .class_size = sizeof(ISASuperIOClass),
.class_init = vt82c686b_superio_class_init,
};
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size
2020-08-22 14:28 ` [PATCH v2 1/2] hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size Philippe Mathieu-Daudé
@ 2020-08-26 16:27 ` Eduardo Habkost
0 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2020-08-26 16:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Michael S. Tsirkin, qemu-devel, Aleksandar Markovic,
Paolo Bonzini, Huacai Chen, Richard Henderson
On Sat, Aug 22, 2020 at 04:28:15PM +0200, Philippe Mathieu-Daudé wrote:
> Instead of setting the instance size on each implementations,
> set it on the abstract parent, so we are sure no implementation
> will forget to set it.
>
> Reported-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Thanks!
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> hw/isa/isa-superio.c | 2 +-
> hw/isa/smc37c669-superio.c | 1 -
> hw/isa/vt82c686.c | 1 -
> 3 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> index e2e47d8fd99..83eb21ebb2a 100644
> --- a/hw/isa/isa-superio.c
> +++ b/hw/isa/isa-superio.c
> @@ -182,6 +182,7 @@ static const TypeInfo isa_superio_type_info = {
> .name = TYPE_ISA_SUPERIO,
> .parent = TYPE_ISA_DEVICE,
> .abstract = true,
> + .instance_size = sizeof(ISASuperIODevice),
> .class_size = sizeof(ISASuperIOClass),
> .class_init = isa_superio_class_init,
> };
> @@ -200,7 +201,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void *data)
> static const TypeInfo fdc37m81x_type_info = {
> .name = TYPE_FDC37M81X_SUPERIO,
> .parent = TYPE_ISA_SUPERIO,
> - .instance_size = sizeof(ISASuperIODevice),
> .class_init = fdc37m81x_class_init,
> };
>
> diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c
> index 18287741cb4..9e59dc16039 100644
> --- a/hw/isa/smc37c669-superio.c
> +++ b/hw/isa/smc37c669-superio.c
> @@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
> static const TypeInfo smc37c669_type_info = {
> .name = TYPE_SMC37C669_SUPERIO,
> .parent = TYPE_ISA_SUPERIO,
> - .instance_size = sizeof(ISASuperIODevice),
> .class_size = sizeof(ISASuperIOClass),
> .class_init = smc37c669_class_init,
> };
> diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
> index 18160ca445d..a4b84d405d0 100644
> --- a/hw/isa/vt82c686.c
> +++ b/hw/isa/vt82c686.c
> @@ -533,7 +533,6 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data)
> static const TypeInfo via_superio_info = {
> .name = TYPE_VT82C686B_SUPERIO,
> .parent = TYPE_ISA_SUPERIO,
> - .instance_size = sizeof(ISASuperIODevice),
> .class_size = sizeof(ISASuperIOClass),
> .class_init = vt82c686b_superio_class_init,
> };
> --
> 2.26.2
>
--
Eduardo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-26 16:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-22 14:28 [PATCH v2 0/2] hw/isa/superio: Clean suspicious QOM types Philippe Mathieu-Daudé
2020-08-22 14:28 ` [PATCH v2 1/2] hw/isa/superio: Set abstract TYPE_ISA_SUPERIO instance size Philippe Mathieu-Daudé
2020-08-26 16:27 ` Eduardo Habkost
2020-08-22 14:28 ` [PATCH v2 2/2] hw/isa/superio: Do not enforce class_size when inherited from parent Philippe Mathieu-Daudé
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).