qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Fix definition of classes with wrong parent
@ 2025-06-05 10:23 Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass Zhenzhong Duan
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Zhenzhong Duan @ 2025-06-05 10:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: chao.p.peng, david, Zhenzhong Duan

Hi,

This fix definition of some classes with wrong parent.
Used below script to get a list, hoping all are addressed.

find "$directory" -type d \( -name "roms" -o -name "build" \) -prune -o -type f \( -name "*.c" -o -name "*.h" \) -print | while read -r file; do
    awk '/^(struct |typedef struct )/ { 
        first = $0;
        getline second; 
        getline third; 
        if (first ~ /[Cc]lass/ && !(second ~ /Class/) && !(third ~ /Class/)) {
            print FILENAME ":" NR-2 ": " first; 
            print FILENAME ":" NR-1 ": " second; 
            print FILENAME ":" NR ": " third;
        }
    }' "$file"
done

patch4/5 are more like cleanups instead of fixes as those class_size are not
initialized so class definition doesn't take effect.

Thanks
Zhenzhong

Changelog:
v3:
- s/Suggested-by/Reported-by on patch2 (David)
- add Closes: tag (David)
- collect RB

v2:
- add more fixes per David


Zhenzhong Duan (5):
  virtio-mem: Fix definition of VirtIOMEMClass
  virtio-pmem: Fix definition of VirtIOPMEMClass
  hw/gpio/aspeed: Fix definition of AspeedGPIOClass
  hw/char/sh_serial: Remove dummy definition of SH_SERIAL class
  hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class

 include/hw/gpio/aspeed_gpio.h   | 2 +-
 include/hw/riscv/iommu.h        | 6 ++----
 include/hw/virtio/virtio-mem.h  | 2 +-
 include/hw/virtio/virtio-pmem.h | 2 +-
 hw/char/sh_serial.c             | 4 +---
 hw/riscv/riscv-iommu-pci.c      | 6 ------
 hw/riscv/riscv-iommu-sys.c      | 6 ------
 7 files changed, 6 insertions(+), 22 deletions(-)

-- 
2.34.1



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

* [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass
  2025-06-05 10:23 [PATCH v3 0/5] Fix definition of classes with wrong parent Zhenzhong Duan
@ 2025-06-05 10:23 ` Zhenzhong Duan
  2025-06-05 10:57   ` Markus Armbruster
  2025-06-05 10:23 ` [PATCH v3 2/5] virtio-pmem: Fix definition of VirtIOPMEMClass Zhenzhong Duan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Zhenzhong Duan @ 2025-06-05 10:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: chao.p.peng, david, Zhenzhong Duan, Philippe Mathieu-Daudé,
	Michael S. Tsirkin

Parent of VirtIOMEMClass is VirtioDeviceClass rather than VirtIODevice.

Fixes: 910b25766b33 ("virtio-mem: Paravirtualized memory hot(un)plug")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/virtio/virtio-mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/virtio/virtio-mem.h b/include/hw/virtio/virtio-mem.h
index bc4f787772..e0ab31b45a 100644
--- a/include/hw/virtio/virtio-mem.h
+++ b/include/hw/virtio/virtio-mem.h
@@ -134,7 +134,7 @@ struct VirtioMemSystemReset {
 
 struct VirtIOMEMClass {
     /* private */
-    VirtIODevice parent;
+    VirtioDeviceClass parent_class;
 
     /* public */
     void (*fill_device_info)(const VirtIOMEM *vmen, VirtioMEMDeviceInfo *vi);
-- 
2.34.1



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

* [PATCH v3 2/5] virtio-pmem: Fix definition of VirtIOPMEMClass
  2025-06-05 10:23 [PATCH v3 0/5] Fix definition of classes with wrong parent Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass Zhenzhong Duan
@ 2025-06-05 10:23 ` Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 3/5] hw/gpio/aspeed: Fix definition of AspeedGPIOClass Zhenzhong Duan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Zhenzhong Duan @ 2025-06-05 10:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: chao.p.peng, david, Zhenzhong Duan, Philippe Mathieu-Daudé,
	Michael S. Tsirkin

VirtIOPMEMClass's parent is VirtioDeviceClass rather than VirtIODevice.

Fixes: 5f503cd9f388 ("virtio-pmem: add virtio device")
Closes: https://lists.gnu.org/archive/html/qemu-devel/2025-06/msg00586.html
Reported-by: David Hildenbrand <david@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 include/hw/virtio/virtio-pmem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/virtio/virtio-pmem.h b/include/hw/virtio/virtio-pmem.h
index fc4fd1f7fe..9cce600d0b 100644
--- a/include/hw/virtio/virtio-pmem.h
+++ b/include/hw/virtio/virtio-pmem.h
@@ -36,7 +36,7 @@ struct VirtIOPMEM {
 
 struct VirtIOPMEMClass {
     /* private */
-    VirtIODevice parent;
+    VirtioDeviceClass parent_class;
 
     /* public */
     void (*fill_device_info)(const VirtIOPMEM *pmem, VirtioPMEMDeviceInfo *vi);
-- 
2.34.1



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

* [PATCH v3 3/5] hw/gpio/aspeed: Fix definition of AspeedGPIOClass
  2025-06-05 10:23 [PATCH v3 0/5] Fix definition of classes with wrong parent Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 2/5] virtio-pmem: Fix definition of VirtIOPMEMClass Zhenzhong Duan
@ 2025-06-05 10:23 ` Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 5/5] hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class Zhenzhong Duan
  4 siblings, 0 replies; 9+ messages in thread
From: Zhenzhong Duan @ 2025-06-05 10:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: chao.p.peng, david, Zhenzhong Duan, Cédric Le Goater,
	Philippe Mathieu-Daudé, Cédric Le Goater, Peter Maydell,
	Steven Lee, Troy Lee, Jamin Lin, Andrew Jeffery, Joel Stanley,
	open list:ASPEED BMCs

AspeedGPIOClass's parent is SysBusDeviceClass rather than SysBusDevice.

Fixes: 4b7f956862dc ("hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500")
Closes: https://lists.gnu.org/archive/html/qemu-devel/2025-06/msg00586.html
Suggested-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 include/hw/gpio/aspeed_gpio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/gpio/aspeed_gpio.h b/include/hw/gpio/aspeed_gpio.h
index e1e6c54333..e6b2fe71b5 100644
--- a/include/hw/gpio/aspeed_gpio.h
+++ b/include/hw/gpio/aspeed_gpio.h
@@ -70,7 +70,7 @@ typedef struct AspeedGPIOReg {
 } AspeedGPIOReg;
 
 struct AspeedGPIOClass {
-    SysBusDevice parent_obj;
+    SysBusDeviceClass parent_class;
     const GPIOSetProperties *props;
     uint32_t nr_gpio_pins;
     uint32_t nr_gpio_sets;
-- 
2.34.1



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

* [PATCH v3 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class
  2025-06-05 10:23 [PATCH v3 0/5] Fix definition of classes with wrong parent Zhenzhong Duan
                   ` (2 preceding siblings ...)
  2025-06-05 10:23 ` [PATCH v3 3/5] hw/gpio/aspeed: Fix definition of AspeedGPIOClass Zhenzhong Duan
@ 2025-06-05 10:23 ` Zhenzhong Duan
  2025-06-05 10:23 ` [PATCH v3 5/5] hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class Zhenzhong Duan
  4 siblings, 0 replies; 9+ messages in thread
From: Zhenzhong Duan @ 2025-06-05 10:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: chao.p.peng, david, Zhenzhong Duan, Yoshinori Sato, Magnus Damm,
	Marc-André Lureau, Paolo Bonzini

SH_SERIAL is declared with OBJECT_DECLARE_SIMPLE_TYPE but defined with
OBJECT_DEFINE_TYPE, SHSerialStateClass is also a dummy class which
missed its parent.

Change to use OBJECT_DEFINE_SIMPLE_TYPE and remove SHSerialStateClass.

Closes: https://lists.gnu.org/archive/html/qemu-devel/2025-06/msg00586.html
Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 hw/char/sh_serial.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 6abd80386f..8ccc2234ba 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -78,9 +78,7 @@ struct SHSerialState {
     qemu_irq bri;
 };
 
-typedef struct {} SHSerialStateClass;
-
-OBJECT_DEFINE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)
+OBJECT_DEFINE_SIMPLE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)
 
 static void sh_serial_clear_fifo(SHSerialState *s)
 {
-- 
2.34.1



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

* [PATCH v3 5/5] hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class
  2025-06-05 10:23 [PATCH v3 0/5] Fix definition of classes with wrong parent Zhenzhong Duan
                   ` (3 preceding siblings ...)
  2025-06-05 10:23 ` [PATCH v3 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class Zhenzhong Duan
@ 2025-06-05 10:23 ` Zhenzhong Duan
  2025-06-05 13:24   ` Daniel Henrique Barboza
  4 siblings, 1 reply; 9+ messages in thread
From: Zhenzhong Duan @ 2025-06-05 10:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: chao.p.peng, david, Zhenzhong Duan, Palmer Dabbelt,
	Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
	open list:RISC-V TCG CPUs

RISCVIOMMUPciClass and RISCVIOMMUSysClass are defined with missed
parent class, class_init on them may corrupt their parent class
fields.

It's lucky that parent_realize and parent_phases are not initialized
or used until now, so just remove the definitions. They can be added
back when really necessary.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 include/hw/riscv/iommu.h   | 6 ++----
 hw/riscv/riscv-iommu-pci.c | 6 ------
 hw/riscv/riscv-iommu-sys.c | 6 ------
 3 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/include/hw/riscv/iommu.h b/include/hw/riscv/iommu.h
index b03339d75c..8a8acfc3f0 100644
--- a/include/hw/riscv/iommu.h
+++ b/include/hw/riscv/iommu.h
@@ -30,14 +30,12 @@ typedef struct RISCVIOMMUState RISCVIOMMUState;
 typedef struct RISCVIOMMUSpace RISCVIOMMUSpace;
 
 #define TYPE_RISCV_IOMMU_PCI "riscv-iommu-pci"
-OBJECT_DECLARE_TYPE(RISCVIOMMUStatePci, RISCVIOMMUPciClass, RISCV_IOMMU_PCI)
+OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUStatePci, RISCV_IOMMU_PCI)
 typedef struct RISCVIOMMUStatePci RISCVIOMMUStatePci;
-typedef struct RISCVIOMMUPciClass RISCVIOMMUPciClass;
 
 #define TYPE_RISCV_IOMMU_SYS "riscv-iommu-device"
-OBJECT_DECLARE_TYPE(RISCVIOMMUStateSys, RISCVIOMMUSysClass, RISCV_IOMMU_SYS)
+OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUStateSys, RISCV_IOMMU_SYS)
 typedef struct RISCVIOMMUStateSys RISCVIOMMUStateSys;
-typedef struct RISCVIOMMUSysClass RISCVIOMMUSysClass;
 
 #define FDT_IRQ_TYPE_EDGE_LOW 1
 
diff --git a/hw/riscv/riscv-iommu-pci.c b/hw/riscv/riscv-iommu-pci.c
index 1f44eef74e..cdb4a7a8f0 100644
--- a/hw/riscv/riscv-iommu-pci.c
+++ b/hw/riscv/riscv-iommu-pci.c
@@ -68,12 +68,6 @@ typedef struct RISCVIOMMUStatePci {
     RISCVIOMMUState  iommu;   /* common IOMMU state */
 } RISCVIOMMUStatePci;
 
-struct RISCVIOMMUPciClass {
-    /*< public >*/
-    DeviceRealize parent_realize;
-    ResettablePhases parent_phases;
-};
-
 /* interrupt delivery callback */
 static void riscv_iommu_pci_notify(RISCVIOMMUState *iommu, unsigned vector)
 {
diff --git a/hw/riscv/riscv-iommu-sys.c b/hw/riscv/riscv-iommu-sys.c
index 74e76b94a5..e34d00aef6 100644
--- a/hw/riscv/riscv-iommu-sys.c
+++ b/hw/riscv/riscv-iommu-sys.c
@@ -53,12 +53,6 @@ struct RISCVIOMMUStateSys {
     uint8_t *msix_pba;
 };
 
-struct RISCVIOMMUSysClass {
-    /*< public >*/
-    DeviceRealize parent_realize;
-    ResettablePhases parent_phases;
-};
-
 static uint64_t msix_table_mmio_read(void *opaque, hwaddr addr,
                                      unsigned size)
 {
-- 
2.34.1



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

* Re: [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass
  2025-06-05 10:23 ` [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass Zhenzhong Duan
@ 2025-06-05 10:57   ` Markus Armbruster
  2025-06-06  9:10     ` Duan, Zhenzhong
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2025-06-05 10:57 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: qemu-devel, chao.p.peng, david, Philippe Mathieu-Daudé,
	Michael S. Tsirkin

Zhenzhong Duan <zhenzhong.duan@intel.com> writes:

> Parent of VirtIOMEMClass is VirtioDeviceClass rather than VirtIODevice.
>
> Fixes: 910b25766b33 ("virtio-mem: Paravirtualized memory hot(un)plug")
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> Reviewed-by: David Hildenbrand <david@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/hw/virtio/virtio-mem.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/hw/virtio/virtio-mem.h b/include/hw/virtio/virtio-mem.h
> index bc4f787772..e0ab31b45a 100644
> --- a/include/hw/virtio/virtio-mem.h
> +++ b/include/hw/virtio/virtio-mem.h
> @@ -134,7 +134,7 @@ struct VirtioMemSystemReset {
>  
>  struct VirtIOMEMClass {
>      /* private */
> -    VirtIODevice parent;
> +    VirtioDeviceClass parent_class;
>  
>      /* public */
>      void (*fill_device_info)(const VirtIOMEM *vmen, VirtioMEMDeviceInfo *vi);

*Ouch*

I guess this isn't catastrophic only because sizeof(VirtIODevice) >
sizeof(VirtioDeviceClass).  Suggest to mention that in the commit
message.

Out of scope for this patch, but I'd really, really appreciate more
consistent spelling of VirtIO.



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

* Re: [PATCH v3 5/5] hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class
  2025-06-05 10:23 ` [PATCH v3 5/5] hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class Zhenzhong Duan
@ 2025-06-05 13:24   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Henrique Barboza @ 2025-06-05 13:24 UTC (permalink / raw)
  To: Zhenzhong Duan, qemu-devel
  Cc: chao.p.peng, david, Palmer Dabbelt, Alistair Francis, Weiwei Li,
	Liu Zhiwei, open list:RISC-V TCG CPUs



On 6/5/25 7:23 AM, Zhenzhong Duan wrote:
> RISCVIOMMUPciClass and RISCVIOMMUSysClass are defined with missed
> parent class, class_init on them may corrupt their parent class
> fields.
> 
> It's lucky that parent_realize and parent_phases are not initialized
> or used until now, so just remove the definitions. They can be added
> back when really necessary.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

>   include/hw/riscv/iommu.h   | 6 ++----
>   hw/riscv/riscv-iommu-pci.c | 6 ------
>   hw/riscv/riscv-iommu-sys.c | 6 ------
>   3 files changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/include/hw/riscv/iommu.h b/include/hw/riscv/iommu.h
> index b03339d75c..8a8acfc3f0 100644
> --- a/include/hw/riscv/iommu.h
> +++ b/include/hw/riscv/iommu.h
> @@ -30,14 +30,12 @@ typedef struct RISCVIOMMUState RISCVIOMMUState;
>   typedef struct RISCVIOMMUSpace RISCVIOMMUSpace;
>   
>   #define TYPE_RISCV_IOMMU_PCI "riscv-iommu-pci"
> -OBJECT_DECLARE_TYPE(RISCVIOMMUStatePci, RISCVIOMMUPciClass, RISCV_IOMMU_PCI)
> +OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUStatePci, RISCV_IOMMU_PCI)
>   typedef struct RISCVIOMMUStatePci RISCVIOMMUStatePci;
> -typedef struct RISCVIOMMUPciClass RISCVIOMMUPciClass;
>   
>   #define TYPE_RISCV_IOMMU_SYS "riscv-iommu-device"
> -OBJECT_DECLARE_TYPE(RISCVIOMMUStateSys, RISCVIOMMUSysClass, RISCV_IOMMU_SYS)
> +OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUStateSys, RISCV_IOMMU_SYS)
>   typedef struct RISCVIOMMUStateSys RISCVIOMMUStateSys;
> -typedef struct RISCVIOMMUSysClass RISCVIOMMUSysClass;
>   
>   #define FDT_IRQ_TYPE_EDGE_LOW 1
>   
> diff --git a/hw/riscv/riscv-iommu-pci.c b/hw/riscv/riscv-iommu-pci.c
> index 1f44eef74e..cdb4a7a8f0 100644
> --- a/hw/riscv/riscv-iommu-pci.c
> +++ b/hw/riscv/riscv-iommu-pci.c
> @@ -68,12 +68,6 @@ typedef struct RISCVIOMMUStatePci {
>       RISCVIOMMUState  iommu;   /* common IOMMU state */
>   } RISCVIOMMUStatePci;
>   
> -struct RISCVIOMMUPciClass {
> -    /*< public >*/
> -    DeviceRealize parent_realize;
> -    ResettablePhases parent_phases;
> -};
> -
>   /* interrupt delivery callback */
>   static void riscv_iommu_pci_notify(RISCVIOMMUState *iommu, unsigned vector)
>   {
> diff --git a/hw/riscv/riscv-iommu-sys.c b/hw/riscv/riscv-iommu-sys.c
> index 74e76b94a5..e34d00aef6 100644
> --- a/hw/riscv/riscv-iommu-sys.c
> +++ b/hw/riscv/riscv-iommu-sys.c
> @@ -53,12 +53,6 @@ struct RISCVIOMMUStateSys {
>       uint8_t *msix_pba;
>   };
>   
> -struct RISCVIOMMUSysClass {
> -    /*< public >*/
> -    DeviceRealize parent_realize;
> -    ResettablePhases parent_phases;
> -};
> -
>   static uint64_t msix_table_mmio_read(void *opaque, hwaddr addr,
>                                        unsigned size)
>   {



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

* RE: [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass
  2025-06-05 10:57   ` Markus Armbruster
@ 2025-06-06  9:10     ` Duan, Zhenzhong
  0 siblings, 0 replies; 9+ messages in thread
From: Duan, Zhenzhong @ 2025-06-06  9:10 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel@nongnu.org, Peng, Chao P, david@redhat.com,
	Philippe Mathieu-Daudé, Michael S. Tsirkin



>-----Original Message-----
>From: Markus Armbruster <armbru@redhat.com>
>Subject: Re: [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass
>
>Zhenzhong Duan <zhenzhong.duan@intel.com> writes:
>
>> Parent of VirtIOMEMClass is VirtioDeviceClass rather than VirtIODevice.
>>
>> Fixes: 910b25766b33 ("virtio-mem: Paravirtualized memory hot(un)plug")
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> Reviewed-by: David Hildenbrand <david@redhat.com>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>  include/hw/virtio/virtio-mem.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/hw/virtio/virtio-mem.h b/include/hw/virtio/virtio-mem.h
>> index bc4f787772..e0ab31b45a 100644
>> --- a/include/hw/virtio/virtio-mem.h
>> +++ b/include/hw/virtio/virtio-mem.h
>> @@ -134,7 +134,7 @@ struct VirtioMemSystemReset {
>>
>>  struct VirtIOMEMClass {
>>      /* private */
>> -    VirtIODevice parent;
>> +    VirtioDeviceClass parent_class;
>>
>>      /* public */
>>      void (*fill_device_info)(const VirtIOMEM *vmen, VirtioMEMDeviceInfo *vi);
>
>*Ouch*
>
>I guess this isn't catastrophic only because sizeof(VirtIODevice) >
>sizeof(VirtioDeviceClass).  Suggest to mention that in the commit
>message.

Will do.

>
>Out of scope for this patch, but I'd really, really appreciate more
>consistent spelling of VirtIO.

Yes. But VirtioDeviceClass is widely used in QEMU for long history,
not clear if it's deserved to s/VirtioDeviceClass/VirtIODeviceClass now..

Thanks
Zhenzhong

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

end of thread, other threads:[~2025-06-06  9:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 10:23 [PATCH v3 0/5] Fix definition of classes with wrong parent Zhenzhong Duan
2025-06-05 10:23 ` [PATCH v3 1/5] virtio-mem: Fix definition of VirtIOMEMClass Zhenzhong Duan
2025-06-05 10:57   ` Markus Armbruster
2025-06-06  9:10     ` Duan, Zhenzhong
2025-06-05 10:23 ` [PATCH v3 2/5] virtio-pmem: Fix definition of VirtIOPMEMClass Zhenzhong Duan
2025-06-05 10:23 ` [PATCH v3 3/5] hw/gpio/aspeed: Fix definition of AspeedGPIOClass Zhenzhong Duan
2025-06-05 10:23 ` [PATCH v3 4/5] hw/char/sh_serial: Remove dummy definition of SH_SERIAL class Zhenzhong Duan
2025-06-05 10:23 ` [PATCH v3 5/5] hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class Zhenzhong Duan
2025-06-05 13:24   ` Daniel Henrique Barboza

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