Skip to content

Commit

Permalink
vfio: Add vfio_get_object callback to VFIODeviceOps
Browse files Browse the repository at this point in the history
Hook vfio_get_object callback for PCI devices.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Neo Jia <cjia@nvidia.com>
Suggested-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Kirti Wankhede authored and awilliam committed Nov 1, 2020
1 parent 0f7a903 commit e93b733
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hw/vfio/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2394,10 +2394,18 @@ static void vfio_pci_compute_needs_reset(VFIODevice *vbasedev)
}
}

static Object *vfio_pci_get_object(VFIODevice *vbasedev)
{
VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);

return OBJECT(vdev);
}

static VFIODeviceOps vfio_pci_ops = {
.vfio_compute_needs_reset = vfio_pci_compute_needs_reset,
.vfio_hot_reset_multi = vfio_pci_hot_reset_multi,
.vfio_eoi = vfio_intx_eoi,
.vfio_get_object = vfio_pci_get_object,
};

int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp)
Expand Down
1 change: 1 addition & 0 deletions include/hw/vfio/vfio-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct VFIODeviceOps {
void (*vfio_compute_needs_reset)(VFIODevice *vdev);
int (*vfio_hot_reset_multi)(VFIODevice *vdev);
void (*vfio_eoi)(VFIODevice *vdev);
Object *(*vfio_get_object)(VFIODevice *vdev);
};

typedef struct VFIOGroup {
Expand Down

0 comments on commit e93b733

Please sign in to comment.