Skip to content

Commit

Permalink
hw/vfio: fix iteration over global VFIODevice list
Browse files Browse the repository at this point in the history
Commit 3d779ab ("vfio/common: Introduce a global VFIODevice list")
introduced a global VFIODevice list, but forgot to update the list
element field name when iterating over the new list. Change the code
to use the correct list element field.

Fixes: 3d779ab ("vfio/common: Introduce a global VFIODevice list")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2061
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
  • Loading branch information
Volker Rümelin authored and legoater committed Jan 5, 2024
1 parent 213ae3f commit 9353b6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hw/vfio/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool vfio_mig_active(void)
return false;
}

QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->migration_blocker) {
return false;
}
Expand All @@ -94,7 +94,7 @@ static bool vfio_multiple_devices_migration_is_supported(void)
unsigned int device_num = 0;
bool all_support_p2p = true;

QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->migration) {
device_num++;

Expand Down Expand Up @@ -1366,13 +1366,13 @@ void vfio_reset_handler(void *opaque)
{
VFIODevice *vbasedev;

QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->dev->realized) {
vbasedev->ops->vfio_compute_needs_reset(vbasedev);
}
}

QLIST_FOREACH(vbasedev, &vfio_device_list, next) {
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->dev->realized && vbasedev->needs_reset) {
vbasedev->ops->vfio_hot_reset_multi(vbasedev);
}
Expand Down

0 comments on commit 9353b6d

Please sign in to comment.