[PATCH 4/6] hw/ppc: pnv_adu.c added 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 4/6] hw/ppc: pnv_adu.c added vmstate support
Posted by Caleb Schlossin 2 days, 8 hours ago
- Added vmstate support for ADU model

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

diff --git a/hw/ppc/pnv_adu.c b/hw/ppc/pnv_adu.c
index 005fbda475..bd2a9e233a 100644
--- a/hw/ppc/pnv_adu.c
+++ b/hw/ppc/pnv_adu.c
@@ -23,6 +23,7 @@
 #include "hw/ppc/pnv_chip.h"
 #include "hw/ppc/pnv_lpc.h"
 #include "hw/ppc/pnv_xscom.h"
+#include "migration/vmstate.h"
 #include "trace.h"
 
 #define ADU_LPC_BASE_REG     0x40
@@ -189,6 +190,16 @@ static const Property pnv_adu_properties[] = {
     DEFINE_PROP_LINK("lpc", PnvADU, lpc, TYPE_PNV_LPC, PnvLpcController *),
 };
 
+static const VMStateDescription pnv_adu_vmstate = {
+    .name = TYPE_PNV_ADU,
+    .version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_UINT64(lpc_cmd_reg, PnvADU),
+        VMSTATE_UINT64(lpc_data_reg, PnvADU),
+        VMSTATE_END_OF_LIST(),
+    },
+};
+
 static void pnv_adu_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -197,6 +208,7 @@ static void pnv_adu_class_init(ObjectClass *klass, const void *data)
     dc->desc = "PowerNV ADU";
     device_class_set_props(dc, pnv_adu_properties);
     dc->user_creatable = false;
+    dc->vmsd = &pnv_adu_vmstate;
 }
 
 static const TypeInfo pnv_adu_type_info = {
-- 
2.47.3
Re: [PATCH 4/6] hw/ppc: pnv_adu.c added 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:
> - Added vmstate support for ADU model
> 
> Signed-off-by: Angelo Jaramillo <angeloj@linux.ibm.com>
> Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
> ---
>  hw/ppc/pnv_adu.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/hw/ppc/pnv_adu.c b/hw/ppc/pnv_adu.c
> index 005fbda475..bd2a9e233a 100644
> --- a/hw/ppc/pnv_adu.c
> +++ b/hw/ppc/pnv_adu.c
> @@ -23,6 +23,7 @@
>  #include "hw/ppc/pnv_chip.h"
>  #include "hw/ppc/pnv_lpc.h"
>  #include "hw/ppc/pnv_xscom.h"
> +#include "migration/vmstate.h"
>  #include "trace.h"
>  
>  #define ADU_LPC_BASE_REG     0x40
> @@ -189,6 +190,16 @@ static const Property pnv_adu_properties[] = {
>      DEFINE_PROP_LINK("lpc", PnvADU, lpc, TYPE_PNV_LPC, PnvLpcController *),
>  };
>  
> +static const VMStateDescription pnv_adu_vmstate = {
> +    .name = TYPE_PNV_ADU,
> +    .version_id = 1,
> +    .fields = (const VMStateField[]) {
> +        VMSTATE_UINT64(lpc_cmd_reg, PnvADU),
> +        VMSTATE_UINT64(lpc_data_reg, PnvADU),
> +        VMSTATE_END_OF_LIST(),
> +    },
> +};
> +
>  static void pnv_adu_class_init(ObjectClass *klass, const void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -197,6 +208,7 @@ static void pnv_adu_class_init(ObjectClass *klass, const void *data)
>      dc->desc = "PowerNV ADU";
>      device_class_set_props(dc, pnv_adu_properties);
>      dc->user_creatable = false;
> +    dc->vmsd = &pnv_adu_vmstate;
>  }
>  
>  static const TypeInfo pnv_adu_type_info = {