[PATCH 3/6] hw/ppc: Add pnv_i2c vmstate support

Caleb Schlossin posted 6 patches 2 days, 8 hours ago
Maintainers: Nicholas Piggin <npiggin@gmail.com>, Aditya Gupta <adityag@linux.ibm.com>, Glenn Miles <milesg@linux.ibm.com>, Alistair Francis <alistair@alistair23.me>
[PATCH 3/6] hw/ppc: Add pnv_i2c vmstate support
Posted by Caleb Schlossin 2 days, 8 hours ago
- Add vmstate support for i2c registers

Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
---
 hw/ppc/pnv_i2c.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/ppc/pnv_i2c.c b/hw/ppc/pnv_i2c.c
index 60de479491..1018078228 100644
--- a/hw/ppc/pnv_i2c.c
+++ b/hw/ppc/pnv_i2c.c
@@ -19,6 +19,7 @@
 #include "hw/ppc/pnv_i2c.h"
 #include "hw/ppc/pnv_xscom.h"
 #include "hw/ppc/fdt.h"
+#include "migration/vmstate.h"
 
 #include <libfdt.h>
 
@@ -549,6 +550,15 @@ static const Property pnv_i2c_properties[] = {
     DEFINE_PROP_UINT32("num-busses", PnvI2C, num_busses, 1),
 };
 
+static const VMStateDescription pnv_i2c_vmstate = {
+    .name = TYPE_PNV_I2C,
+    .version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_UINT64_ARRAY(regs, PnvI2C, PNV_I2C_REGS),
+        VMSTATE_END_OF_LIST(),
+    },
+};
+
 static void pnv_i2c_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -561,6 +571,7 @@ static void pnv_i2c_class_init(ObjectClass *klass, const void *data)
 
     dc->desc = "PowerNV I2C";
     dc->realize = pnv_i2c_realize;
+    dc->vmsd = &pnv_i2c_vmstate;
     device_class_set_props(dc, pnv_i2c_properties);
 }
 
-- 
2.47.3
Re: [PATCH 3/6] hw/ppc: Add pnv_i2c vmstate support
Posted by Miles Glenn 1 day, 13 hours ago
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>

On Thu, 2025-12-11 at 16:09 -0600, Caleb Schlossin wrote:
> - Add vmstate support for i2c registers
> 
> Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
> ---
>  hw/ppc/pnv_i2c.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/hw/ppc/pnv_i2c.c b/hw/ppc/pnv_i2c.c
> index 60de479491..1018078228 100644
> --- a/hw/ppc/pnv_i2c.c
> +++ b/hw/ppc/pnv_i2c.c
> @@ -19,6 +19,7 @@
>  #include "hw/ppc/pnv_i2c.h"
>  #include "hw/ppc/pnv_xscom.h"
>  #include "hw/ppc/fdt.h"
> +#include "migration/vmstate.h"
>  
>  #include <libfdt.h>
>  
> @@ -549,6 +550,15 @@ static const Property pnv_i2c_properties[] = {
>      DEFINE_PROP_UINT32("num-busses", PnvI2C, num_busses, 1),
>  };
>  
> +static const VMStateDescription pnv_i2c_vmstate = {
> +    .name = TYPE_PNV_I2C,
> +    .version_id = 1,
> +    .fields = (const VMStateField[]) {
> +        VMSTATE_UINT64_ARRAY(regs, PnvI2C, PNV_I2C_REGS),
> +        VMSTATE_END_OF_LIST(),
> +    },
> +};
> +
>  static void pnv_i2c_class_init(ObjectClass *klass, const void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -561,6 +571,7 @@ static void pnv_i2c_class_init(ObjectClass *klass, const void *data)
>  
>      dc->desc = "PowerNV I2C";
>      dc->realize = pnv_i2c_realize;
> +    dc->vmsd = &pnv_i2c_vmstate;
>      device_class_set_props(dc, pnv_i2c_properties);
>  }
>