On Wed, Feb 11, 2026 at 06:15:32PM +0100, Cédric Le Goater wrote:
> The file migration/cpr.c uses vmstate_cpr_vfio_devices which is
> declared in hw/vfio/vfio-cpr.h, not in hw/vfio/vfio-device.h.
> 
> Replace the include with the correct header file to avoid pulling in
> unnecessary VFIO device declarations.
> 
> Signed-off-by: Cédric Le Goater <[email protected]>
> ---
>  migration/cpr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration/cpr.c b/migration/cpr.c
> index 
> adee2a919a364244867ef190fdf29bd1fe7e20e2..a0b37007f55d6dac32bd6220ffe65d32c4e6b52e
>  100644
> --- a/migration/cpr.c
> +++ b/migration/cpr.c
> @@ -9,7 +9,7 @@
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "qemu/error-report.h"
> -#include "hw/vfio/vfio-device.h"
> +#include "hw/vfio/vfio-cpr.h"
>  #include "migration/cpr.h"
>  #include "migration/misc.h"
>  #include "migration/options.h"
> -- 
> 2.53.0
> 

This should be better as a standalone change, thanks.

Reviewed-by: Peter Xu <[email protected]>

Some thoughts beyond this patch alone.

When looking at this, it's a layer violation.  Logically migration/cpr.c
shouldn't include a vfio header, otherwise it means when new devices added
to support cpr then migration needs to include headers to every single of
these devices..

Logically it should be the other way round where migration/cpr.c should
provide a helper allowing devices to opt-in for cpr-states to register
instead.

Now it's also awkward that vmstate_cpr_state always have a subsection
called vmstate_cpr_vfio_devices.. it means we will migrate this subsection
even if there's no vfio device..  that's also another point that I think it
should be done the other way round..

I do not know whether we must persist CPR ABI now.. if we need, we can't
change this anymore without a machine type compat entry (as we will expect
vmstate_cpr_vfio_devices to come from an older binary that does a cpr
migration).  But that'll be sad..

Thanks,

-- 
Peter Xu


Reply via email to