mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
virtio: add vhost support for virtio devices
This patch adds a get_vhost() callback function for VirtIODevices that returns the device's corresponding vhost_dev structure, if the vhost device is running. This patch also adds a vhost_started flag for VirtIODevices. Previously, a VirtIODevice wouldn't be able to tell if its corresponding vhost device was active or not. Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com> Message-Id: <1648819405-25696-3-git-send-email-jonah.palmer@oracle.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
3857cd5c7f
commit
c255488d67
12 changed files with 76 additions and 1 deletions
|
@ -273,6 +273,13 @@ static void vhost_scsi_unrealize(DeviceState *dev)
|
|||
virtio_scsi_common_unrealize(dev);
|
||||
}
|
||||
|
||||
static struct vhost_dev *vhost_scsi_get_vhost(VirtIODevice *vdev)
|
||||
{
|
||||
VHostSCSI *s = VHOST_SCSI(vdev);
|
||||
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
|
||||
return &vsc->dev;
|
||||
}
|
||||
|
||||
static Property vhost_scsi_properties[] = {
|
||||
DEFINE_PROP_STRING("vhostfd", VirtIOSCSICommon, conf.vhostfd),
|
||||
DEFINE_PROP_STRING("wwpn", VirtIOSCSICommon, conf.wwpn),
|
||||
|
@ -307,6 +314,7 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data)
|
|||
vdc->get_features = vhost_scsi_common_get_features;
|
||||
vdc->set_config = vhost_scsi_common_set_config;
|
||||
vdc->set_status = vhost_scsi_set_status;
|
||||
vdc->get_vhost = vhost_scsi_get_vhost;
|
||||
fwc->get_dev_path = vhost_scsi_common_get_fw_dev_path;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue