mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06:00

"hw/vfio/vfio-common.h" has been emptied of most of its declarations by the previous changes and the only declarations left are related to VFIODevice. Rename it to "hw/vfio/vfio-device.h" and make the necessary adjustments. Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-36-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
/*
|
|
* Copyright (c) 2021-2024 Oracle and/or its affiliates.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "hw/vfio/vfio-device.h"
|
|
#include "migration/misc.h"
|
|
#include "qapi/error.h"
|
|
#include "system/runstate.h"
|
|
#include "vfio-cpr.h"
|
|
|
|
static int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier,
|
|
MigrationEvent *e, Error **errp)
|
|
{
|
|
if (e->type == MIG_EVENT_PRECOPY_SETUP &&
|
|
!runstate_check(RUN_STATE_SUSPENDED) && !vm_get_suspended()) {
|
|
|
|
error_setg(errp,
|
|
"VFIO device only supports cpr-reboot for runstate suspended");
|
|
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
bool vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **errp)
|
|
{
|
|
migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier,
|
|
vfio_cpr_reboot_notifier,
|
|
MIG_MODE_CPR_REBOOT);
|
|
return true;
|
|
}
|
|
|
|
void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer)
|
|
{
|
|
migration_remove_notifier(&bcontainer->cpr_reboot_notifier);
|
|
}
|