On Tue, Sep 16, 2025 at 9:59 AM Stevie Alvarez <[email protected]> wrote:
+ CC Corey Minyard for I2C maintainers.
>
> From: Patrick Venture <[email protected]>
>
> Add missing vmstate support.
>
> Signed-off-by: Patrick Venture <[email protected]>
> ---
> hw/i2c/i2c_mux_pca954x.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/hw/i2c/i2c_mux_pca954x.c b/hw/i2c/i2c_mux_pca954x.c
> index a8ef640cd2..78828acafb 100644
> --- a/hw/i2c/i2c_mux_pca954x.c
> +++ b/hw/i2c/i2c_mux_pca954x.c
> @@ -22,6 +22,7 @@
> #include "hw/qdev-core.h"
> #include "hw/qdev-properties.h"
> #include "hw/sysbus.h"
> +#include "migration/vmstate.h"
> #include "qemu/log.h"
> #include "qemu/module.h"
> #include "qemu/queue.h"
> @@ -211,6 +212,18 @@ static void pca954x_init(Object *obj)
> }
> }
>
> +static const VMStateDescription pca954x_vmstate = {
> + .name = TYPE_PCA954X,
> + .version_id = 0,
> + .minimum_version_id = 0,
> + .fields = (VMStateField[]) {
> + VMSTATE_SMBUS_DEVICE(parent, Pca954xState),
> + VMSTATE_UINT8(control, Pca954xState),
> + VMSTATE_BOOL_ARRAY(enabled, Pca954xState, PCA9548_CHANNEL_COUNT),
> + VMSTATE_END_OF_LIST()
> + }
> +};
> +
> static const Property pca954x_props[] = {
> DEFINE_PROP_STRING("name", Pca954xState, name),
> };
> @@ -228,6 +241,7 @@ static void pca954x_class_init(ObjectClass *klass, const
> void *data)
>
> dc->desc = "Pca954x i2c-mux";
> dc->realize = pca954x_realize;
> + dc->vmsd = &pca954x_vmstate;
>
> k->write_data = pca954x_write_data;
> k->receive_byte = pca954x_read_byte;
> --
> 2.51.0.384.g4c02a37b29-goog
>