2011-06-01 11:05:13 +04:00
|
|
|
/*
|
|
|
|
* Virtio PCI Bindings
|
|
|
|
*
|
|
|
|
* Copyright IBM, Corp. 2007
|
|
|
|
* Copyright (c) 2009 CodeSourcery
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
|
|
* Paul Brook <paul@codesourcery.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
|
|
* the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QEMU_VIRTIO_PCI_H
|
|
|
|
#define QEMU_VIRTIO_PCI_H
|
|
|
|
|
2013-01-15 01:52:02 +04:00
|
|
|
#include "hw/pci/msi.h"
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/virtio/virtio-blk.h"
|
|
|
|
#include "hw/virtio/virtio-net.h"
|
|
|
|
#include "hw/virtio/virtio-rng.h"
|
|
|
|
#include "hw/virtio/virtio-serial.h"
|
|
|
|
#include "hw/virtio/virtio-scsi.h"
|
|
|
|
#include "hw/virtio/virtio-balloon.h"
|
|
|
|
#include "hw/virtio/virtio-bus.h"
|
2015-06-04 13:34:41 +03:00
|
|
|
#include "hw/virtio/virtio-input.h"
|
2014-09-10 16:20:34 +04:00
|
|
|
#include "hw/virtio/virtio-gpu.h"
|
2016-10-28 11:33:25 +03:00
|
|
|
#include "hw/virtio/virtio-crypto.h"
|
2017-03-02 21:25:52 +03:00
|
|
|
#include "hw/virtio/vhost-user-scsi.h"
|
vhost-user-blk: introduce a new vhost-user-blk host device
This commit introduces a new vhost-user device for block, it uses a
chardev to connect with the backend, same with Qemu virito-blk device,
Guest OS still uses the virtio-blk frontend driver.
To use it, start QEMU with command line like this:
qemu-system-x86_64 \
-chardev socket,id=char0,path=/path/vhost.socket \
-device vhost-user-blk-pci,chardev=char0,num-queues=2, \
bootindex=2... \
Users can use different parameters for `num-queues` and `bootindex`.
Different with exist Qemu virtio-blk host device, it makes more easy
for users to implement their own I/O processing logic, such as all
user space I/O stack against hardware block device. It uses the new
vhost messages(VHOST_USER_GET_CONFIG) to get block virtio config
information from backend process.
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2018-01-04 04:53:32 +03:00
|
|
|
#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX)
|
|
|
|
#include "hw/virtio/vhost-user-blk.h"
|
|
|
|
#endif
|
2016-10-28 11:33:25 +03:00
|
|
|
|
2013-04-23 13:08:41 +04:00
|
|
|
#ifdef CONFIG_VIRTFS
|
|
|
|
#include "hw/9pfs/virtio-9p.h"
|
|
|
|
#endif
|
2013-03-29 05:08:16 +04:00
|
|
|
#ifdef CONFIG_VHOST_SCSI
|
|
|
|
#include "hw/virtio/vhost-scsi.h"
|
|
|
|
#endif
|
2016-08-16 15:27:22 +03:00
|
|
|
#ifdef CONFIG_VHOST_VSOCK
|
|
|
|
#include "hw/virtio/vhost-vsock.h"
|
|
|
|
#endif
|
2013-01-15 03:08:03 +04:00
|
|
|
|
2013-01-15 03:08:04 +04:00
|
|
|
typedef struct VirtIOPCIProxy VirtIOPCIProxy;
|
2013-03-18 20:37:23 +04:00
|
|
|
typedef struct VirtIOBlkPCI VirtIOBlkPCI;
|
2013-03-21 18:15:15 +04:00
|
|
|
typedef struct VirtIOSCSIPCI VirtIOSCSIPCI;
|
2013-03-27 13:49:11 +04:00
|
|
|
typedef struct VirtIOBalloonPCI VirtIOBalloonPCI;
|
2013-04-09 16:53:31 +04:00
|
|
|
typedef struct VirtIOSerialPCI VirtIOSerialPCI;
|
2013-04-11 18:29:58 +04:00
|
|
|
typedef struct VirtIONetPCI VirtIONetPCI;
|
2013-03-29 05:08:16 +04:00
|
|
|
typedef struct VHostSCSIPCI VHostSCSIPCI;
|
2017-03-02 21:25:52 +03:00
|
|
|
typedef struct VHostUserSCSIPCI VHostUserSCSIPCI;
|
vhost-user-blk: introduce a new vhost-user-blk host device
This commit introduces a new vhost-user device for block, it uses a
chardev to connect with the backend, same with Qemu virito-blk device,
Guest OS still uses the virtio-blk frontend driver.
To use it, start QEMU with command line like this:
qemu-system-x86_64 \
-chardev socket,id=char0,path=/path/vhost.socket \
-device vhost-user-blk-pci,chardev=char0,num-queues=2, \
bootindex=2... \
Users can use different parameters for `num-queues` and `bootindex`.
Different with exist Qemu virtio-blk host device, it makes more easy
for users to implement their own I/O processing logic, such as all
user space I/O stack against hardware block device. It uses the new
vhost messages(VHOST_USER_GET_CONFIG) to get block virtio config
information from backend process.
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2018-01-04 04:53:32 +03:00
|
|
|
typedef struct VHostUserBlkPCI VHostUserBlkPCI;
|
2013-04-24 12:07:56 +04:00
|
|
|
typedef struct VirtIORngPCI VirtIORngPCI;
|
2015-06-04 13:34:41 +03:00
|
|
|
typedef struct VirtIOInputPCI VirtIOInputPCI;
|
2015-06-04 13:34:42 +03:00
|
|
|
typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI;
|
2014-03-28 12:18:47 +04:00
|
|
|
typedef struct VirtIOInputHostPCI VirtIOInputHostPCI;
|
2014-09-10 16:20:34 +04:00
|
|
|
typedef struct VirtIOGPUPCI VirtIOGPUPCI;
|
2016-08-16 15:27:22 +03:00
|
|
|
typedef struct VHostVSockPCI VHostVSockPCI;
|
2016-10-28 11:33:25 +03:00
|
|
|
typedef struct VirtIOCryptoPCI VirtIOCryptoPCI;
|
2013-01-15 03:08:04 +04:00
|
|
|
|
2013-01-15 03:08:03 +04:00
|
|
|
/* virtio-pci-bus */
|
|
|
|
|
|
|
|
typedef struct VirtioBusState VirtioPCIBusState;
|
|
|
|
typedef struct VirtioBusClass VirtioPCIBusClass;
|
|
|
|
|
|
|
|
#define TYPE_VIRTIO_PCI_BUS "virtio-pci-bus"
|
|
|
|
#define VIRTIO_PCI_BUS(obj) \
|
|
|
|
OBJECT_CHECK(VirtioPCIBusState, (obj), TYPE_VIRTIO_PCI_BUS)
|
|
|
|
#define VIRTIO_PCI_BUS_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(VirtioPCIBusClass, obj, TYPE_VIRTIO_PCI_BUS)
|
|
|
|
#define VIRTIO_PCI_BUS_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
|
2011-06-01 11:05:13 +04:00
|
|
|
|
2016-02-10 16:31:13 +03:00
|
|
|
enum {
|
|
|
|
VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT,
|
|
|
|
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
|
|
|
|
VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT,
|
|
|
|
VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
|
|
|
|
VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT,
|
2016-09-07 18:02:25 +03:00
|
|
|
VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT,
|
2016-12-30 13:09:15 +03:00
|
|
|
VIRTIO_PCI_FLAG_ATS_BIT,
|
2017-02-20 23:43:11 +03:00
|
|
|
VIRTIO_PCI_FLAG_INIT_DEVERR_BIT,
|
2017-02-20 23:43:12 +03:00
|
|
|
VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
|
2017-02-20 23:43:13 +03:00
|
|
|
VIRTIO_PCI_FLAG_INIT_PM_BIT,
|
2016-02-10 16:31:13 +03:00
|
|
|
};
|
|
|
|
|
2014-10-14 20:40:06 +04:00
|
|
|
/* Need to activate work-arounds for buggy guests at vmstate load. */
|
|
|
|
#define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION \
|
|
|
|
(1 << VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT)
|
|
|
|
|
2011-10-12 17:41:23 +04:00
|
|
|
/* Performance improves when virtqueue kick processing is decoupled from the
|
|
|
|
* vcpu thread using ioeventfd for some devices. */
|
|
|
|
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
|
|
|
|
|
2015-06-04 13:34:26 +03:00
|
|
|
/* virtio version flags */
|
2015-11-10 14:41:29 +03:00
|
|
|
#define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
|
2015-06-04 13:34:26 +03:00
|
|
|
|
2015-11-06 11:02:44 +03:00
|
|
|
/* migrate extra state */
|
|
|
|
#define VIRTIO_PCI_FLAG_MIGRATE_EXTRA (1 << VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT)
|
|
|
|
|
2015-11-06 11:02:48 +03:00
|
|
|
/* have pio notification for modern device ? */
|
|
|
|
#define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY \
|
|
|
|
(1 << VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT)
|
|
|
|
|
2016-09-07 18:02:25 +03:00
|
|
|
/* page per vq flag to be used by split drivers within guests */
|
|
|
|
#define VIRTIO_PCI_FLAG_PAGE_PER_VQ \
|
|
|
|
(1 << VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT)
|
|
|
|
|
2016-12-30 13:09:15 +03:00
|
|
|
/* address space translation service */
|
|
|
|
#define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
|
|
|
|
|
2017-02-20 23:43:11 +03:00
|
|
|
/* Init error enabling flags */
|
|
|
|
#define VIRTIO_PCI_FLAG_INIT_DEVERR (1 << VIRTIO_PCI_FLAG_INIT_DEVERR_BIT)
|
|
|
|
|
2017-02-20 23:43:12 +03:00
|
|
|
/* Init Link Control register */
|
|
|
|
#define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
|
|
|
|
|
2017-02-20 23:43:13 +03:00
|
|
|
/* Init Power Management */
|
|
|
|
#define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
|
|
|
|
|
2012-05-17 17:32:39 +04:00
|
|
|
typedef struct {
|
2012-12-21 02:27:54 +04:00
|
|
|
MSIMessage msg;
|
2012-05-17 17:32:39 +04:00
|
|
|
int virq;
|
|
|
|
unsigned int users;
|
|
|
|
} VirtIOIRQFD;
|
|
|
|
|
2013-01-15 03:08:04 +04:00
|
|
|
/*
|
|
|
|
* virtio-pci: This is the PCIDevice which has a virtio-pci-bus.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_PCI "virtio-pci"
|
|
|
|
#define VIRTIO_PCI_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI)
|
|
|
|
#define VIRTIO_PCI_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI)
|
|
|
|
#define VIRTIO_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI)
|
|
|
|
|
|
|
|
typedef struct VirtioPCIClass {
|
|
|
|
PCIDeviceClass parent_class;
|
2015-12-02 20:49:07 +03:00
|
|
|
DeviceRealize parent_dc_realize;
|
2015-02-27 16:52:14 +03:00
|
|
|
void (*realize)(VirtIOPCIProxy *vpci_dev, Error **errp);
|
2013-01-15 03:08:04 +04:00
|
|
|
} VirtioPCIClass;
|
|
|
|
|
2015-06-04 13:34:33 +03:00
|
|
|
typedef struct VirtIOPCIRegion {
|
|
|
|
MemoryRegion mr;
|
2015-06-04 13:34:35 +03:00
|
|
|
uint32_t offset;
|
2015-06-04 13:34:39 +03:00
|
|
|
uint32_t size;
|
2015-06-04 13:34:37 +03:00
|
|
|
uint32_t type;
|
2015-06-04 13:34:33 +03:00
|
|
|
} VirtIOPCIRegion;
|
|
|
|
|
2015-11-06 11:02:44 +03:00
|
|
|
typedef struct VirtIOPCIQueue {
|
|
|
|
uint16_t num;
|
|
|
|
bool enabled;
|
|
|
|
uint32_t desc[2];
|
|
|
|
uint32_t avail[2];
|
|
|
|
uint32_t used[2];
|
|
|
|
} VirtIOPCIQueue;
|
|
|
|
|
2013-01-15 03:08:04 +04:00
|
|
|
struct VirtIOPCIProxy {
|
2011-06-01 11:05:13 +04:00
|
|
|
PCIDevice pci_dev;
|
2011-08-08 17:09:13 +04:00
|
|
|
MemoryRegion bar;
|
2017-10-09 06:19:41 +03:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
VirtIOPCIRegion common;
|
|
|
|
VirtIOPCIRegion isr;
|
|
|
|
VirtIOPCIRegion device;
|
|
|
|
VirtIOPCIRegion notify;
|
|
|
|
VirtIOPCIRegion notify_pio;
|
|
|
|
};
|
|
|
|
VirtIOPCIRegion regs[5];
|
|
|
|
};
|
2015-06-04 13:34:22 +03:00
|
|
|
MemoryRegion modern_bar;
|
2015-11-06 11:02:48 +03:00
|
|
|
MemoryRegion io_bar;
|
2016-09-29 07:04:40 +03:00
|
|
|
uint32_t legacy_io_bar_idx;
|
|
|
|
uint32_t msix_bar_idx;
|
|
|
|
uint32_t modern_io_bar_idx;
|
|
|
|
uint32_t modern_mem_bar_idx;
|
2015-07-02 15:59:49 +03:00
|
|
|
int config_cap;
|
2011-06-01 11:05:13 +04:00
|
|
|
uint32_t flags;
|
2016-07-20 18:28:21 +03:00
|
|
|
bool disable_modern;
|
2016-12-14 19:30:35 +03:00
|
|
|
bool ignore_backend_features;
|
2016-07-20 18:28:21 +03:00
|
|
|
OnOffAuto disable_legacy;
|
2011-06-01 11:05:13 +04:00
|
|
|
uint32_t class_code;
|
|
|
|
uint32_t nvectors;
|
2015-06-04 13:34:22 +03:00
|
|
|
uint32_t dfselect;
|
|
|
|
uint32_t gfselect;
|
|
|
|
uint32_t guest_features[2];
|
2015-11-06 11:02:44 +03:00
|
|
|
VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
|
2015-06-04 13:34:22 +03:00
|
|
|
|
2012-05-17 17:32:39 +04:00
|
|
|
VirtIOIRQFD *vector_irqfd;
|
2012-12-20 16:28:58 +04:00
|
|
|
int nvqs_with_notifiers;
|
2013-01-15 03:08:04 +04:00
|
|
|
VirtioBusState bus;
|
|
|
|
};
|
2011-06-01 11:05:13 +04:00
|
|
|
|
2016-07-20 18:28:21 +03:00
|
|
|
static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)
|
|
|
|
{
|
|
|
|
return !proxy->disable_modern;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy)
|
|
|
|
{
|
|
|
|
return proxy->disable_legacy == ON_OFF_AUTO_OFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy)
|
|
|
|
{
|
|
|
|
proxy->disable_modern = false;
|
|
|
|
proxy->disable_legacy = ON_OFF_AUTO_ON;
|
|
|
|
}
|
2013-03-21 18:15:15 +04:00
|
|
|
|
2016-09-13 16:30:30 +03:00
|
|
|
static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)
|
|
|
|
{
|
|
|
|
proxy->disable_modern = true;
|
|
|
|
}
|
|
|
|
|
2013-03-21 18:15:15 +04:00
|
|
|
/*
|
|
|
|
* virtio-scsi-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci"
|
|
|
|
#define VIRTIO_SCSI_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI)
|
|
|
|
|
|
|
|
struct VirtIOSCSIPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOSCSI vdev;
|
|
|
|
};
|
|
|
|
|
2013-03-29 05:08:16 +04:00
|
|
|
#ifdef CONFIG_VHOST_SCSI
|
|
|
|
/*
|
|
|
|
* vhost-scsi-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci"
|
|
|
|
#define VHOST_SCSI_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VHostSCSIPCI, (obj), TYPE_VHOST_SCSI_PCI)
|
|
|
|
|
|
|
|
struct VHostSCSIPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VHostSCSI vdev;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2017-03-02 21:25:52 +03:00
|
|
|
#define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci"
|
|
|
|
#define VHOST_USER_SCSI_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VHostUserSCSIPCI, (obj), TYPE_VHOST_USER_SCSI_PCI)
|
|
|
|
|
|
|
|
struct VHostUserSCSIPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VHostUserSCSI vdev;
|
|
|
|
};
|
|
|
|
|
vhost-user-blk: introduce a new vhost-user-blk host device
This commit introduces a new vhost-user device for block, it uses a
chardev to connect with the backend, same with Qemu virito-blk device,
Guest OS still uses the virtio-blk frontend driver.
To use it, start QEMU with command line like this:
qemu-system-x86_64 \
-chardev socket,id=char0,path=/path/vhost.socket \
-device vhost-user-blk-pci,chardev=char0,num-queues=2, \
bootindex=2... \
Users can use different parameters for `num-queues` and `bootindex`.
Different with exist Qemu virtio-blk host device, it makes more easy
for users to implement their own I/O processing logic, such as all
user space I/O stack against hardware block device. It uses the new
vhost messages(VHOST_USER_GET_CONFIG) to get block virtio config
information from backend process.
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2018-01-04 04:53:32 +03:00
|
|
|
#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX)
|
|
|
|
/*
|
|
|
|
* vhost-user-blk-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VHOST_USER_BLK_PCI "vhost-user-blk-pci"
|
|
|
|
#define VHOST_USER_BLK_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VHostUserBlkPCI, (obj), TYPE_VHOST_USER_BLK_PCI)
|
|
|
|
|
|
|
|
struct VHostUserBlkPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VHostUserBlk vdev;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2013-03-18 20:37:23 +04:00
|
|
|
/*
|
|
|
|
* virtio-blk-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci"
|
|
|
|
#define VIRTIO_BLK_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI)
|
|
|
|
|
|
|
|
struct VirtIOBlkPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOBlock vdev;
|
|
|
|
};
|
|
|
|
|
2013-03-27 13:49:11 +04:00
|
|
|
/*
|
|
|
|
* virtio-balloon-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci"
|
|
|
|
#define VIRTIO_BALLOON_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOBalloonPCI, (obj), TYPE_VIRTIO_BALLOON_PCI)
|
|
|
|
|
|
|
|
struct VirtIOBalloonPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOBalloon vdev;
|
|
|
|
};
|
|
|
|
|
2013-04-09 16:53:31 +04:00
|
|
|
/*
|
|
|
|
* virtio-serial-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_SERIAL_PCI "virtio-serial-pci"
|
|
|
|
#define VIRTIO_SERIAL_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOSerialPCI, (obj), TYPE_VIRTIO_SERIAL_PCI)
|
|
|
|
|
|
|
|
struct VirtIOSerialPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOSerial vdev;
|
|
|
|
};
|
|
|
|
|
2013-04-11 18:29:58 +04:00
|
|
|
/*
|
|
|
|
* virtio-net-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_NET_PCI "virtio-net-pci"
|
|
|
|
#define VIRTIO_NET_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIONetPCI, (obj), TYPE_VIRTIO_NET_PCI)
|
|
|
|
|
|
|
|
struct VirtIONetPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIONet vdev;
|
|
|
|
};
|
|
|
|
|
2013-04-23 13:08:41 +04:00
|
|
|
/*
|
|
|
|
* virtio-9p-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_VIRTFS
|
|
|
|
|
|
|
|
#define TYPE_VIRTIO_9P_PCI "virtio-9p-pci"
|
|
|
|
#define VIRTIO_9P_PCI(obj) \
|
|
|
|
OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI)
|
|
|
|
|
|
|
|
typedef struct V9fsPCIState {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
2016-01-11 12:29:37 +03:00
|
|
|
V9fsVirtioState vdev;
|
2013-04-23 13:08:41 +04:00
|
|
|
} V9fsPCIState;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-04-24 12:07:56 +04:00
|
|
|
/*
|
|
|
|
* virtio-rng-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_RNG_PCI "virtio-rng-pci"
|
|
|
|
#define VIRTIO_RNG_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIORngPCI, (obj), TYPE_VIRTIO_RNG_PCI)
|
|
|
|
|
|
|
|
struct VirtIORngPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIORNG vdev;
|
|
|
|
};
|
|
|
|
|
2015-06-04 13:34:41 +03:00
|
|
|
/*
|
|
|
|
* virtio-input-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_INPUT_PCI "virtio-input-pci"
|
|
|
|
#define VIRTIO_INPUT_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOInputPCI, (obj), TYPE_VIRTIO_INPUT_PCI)
|
|
|
|
|
|
|
|
struct VirtIOInputPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOInput vdev;
|
|
|
|
};
|
|
|
|
|
2015-06-04 13:34:42 +03:00
|
|
|
#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci"
|
|
|
|
#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci"
|
|
|
|
#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci"
|
|
|
|
#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci"
|
|
|
|
#define VIRTIO_INPUT_HID_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOInputHIDPCI, (obj), TYPE_VIRTIO_INPUT_HID_PCI)
|
|
|
|
|
|
|
|
struct VirtIOInputHIDPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOInputHID vdev;
|
|
|
|
};
|
|
|
|
|
virtio-input: Fix device introspection on non-Linux hosts
When CONFIG_LINUX is off, devices "virtio-keyboard-device",
"virtio-mouse-device", "virtio-tablet-device" and
"virtio-input-host-device" aren't compiled in, yet
"virtio-keyboard-pci", "virtio-mouse-pci", "virtio-tablet-pci" and
"virtio-input-host-pci" still are. Attempts to introspect them crash,
e.g.
$ qemu-system-x86_64 -device virtio-tablet-pci,help
**
ERROR:/work/armbru/qemu/qom/object.c:333:object_initialize_with_type: assertion failed: (type != NULL)
Broken in commit 710e2d9 and commit 006a5ed.
Fix by compiling the "virtio-FOO-pci" exactly when compiling the
"virtio-FOO-device": compile "virtio-keyboard-device",
"virtio-mouse-device", "virtio-tablet-device" regardless of
CONFIG_LINUX, and compile "virtio-input-host-pci" only for
CONFIG_LINUX.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <1444320700-26260-3-git-send-email-armbru@redhat.com>
2015-10-08 19:11:40 +03:00
|
|
|
#ifdef CONFIG_LINUX
|
|
|
|
|
2014-03-28 12:18:47 +04:00
|
|
|
#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci"
|
|
|
|
#define VIRTIO_INPUT_HOST_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI)
|
|
|
|
|
|
|
|
struct VirtIOInputHostPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOInputHost vdev;
|
|
|
|
};
|
|
|
|
|
virtio-input: Fix device introspection on non-Linux hosts
When CONFIG_LINUX is off, devices "virtio-keyboard-device",
"virtio-mouse-device", "virtio-tablet-device" and
"virtio-input-host-device" aren't compiled in, yet
"virtio-keyboard-pci", "virtio-mouse-pci", "virtio-tablet-pci" and
"virtio-input-host-pci" still are. Attempts to introspect them crash,
e.g.
$ qemu-system-x86_64 -device virtio-tablet-pci,help
**
ERROR:/work/armbru/qemu/qom/object.c:333:object_initialize_with_type: assertion failed: (type != NULL)
Broken in commit 710e2d9 and commit 006a5ed.
Fix by compiling the "virtio-FOO-pci" exactly when compiling the
"virtio-FOO-device": compile "virtio-keyboard-device",
"virtio-mouse-device", "virtio-tablet-device" regardless of
CONFIG_LINUX, and compile "virtio-input-host-pci" only for
CONFIG_LINUX.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <1444320700-26260-3-git-send-email-armbru@redhat.com>
2015-10-08 19:11:40 +03:00
|
|
|
#endif
|
|
|
|
|
2014-09-10 16:20:34 +04:00
|
|
|
/*
|
|
|
|
* virtio-gpu-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci"
|
|
|
|
#define VIRTIO_GPU_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI)
|
|
|
|
|
|
|
|
struct VirtIOGPUPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOGPU vdev;
|
|
|
|
};
|
|
|
|
|
2016-08-16 15:27:22 +03:00
|
|
|
#ifdef CONFIG_VHOST_VSOCK
|
|
|
|
/*
|
|
|
|
* vhost-vsock-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VHOST_VSOCK_PCI "vhost-vsock-pci"
|
|
|
|
#define VHOST_VSOCK_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VHostVSockPCI, (obj), TYPE_VHOST_VSOCK_PCI)
|
|
|
|
|
|
|
|
struct VHostVSockPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VHostVSock vdev;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2016-10-28 11:33:25 +03:00
|
|
|
/*
|
|
|
|
* virtio-crypto-pci: This extends VirtioPCIProxy.
|
|
|
|
*/
|
|
|
|
#define TYPE_VIRTIO_CRYPTO_PCI "virtio-crypto-pci"
|
|
|
|
#define VIRTIO_CRYPTO_PCI(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOCryptoPCI, (obj), TYPE_VIRTIO_CRYPTO_PCI)
|
|
|
|
|
|
|
|
struct VirtIOCryptoPCI {
|
|
|
|
VirtIOPCIProxy parent_obj;
|
|
|
|
VirtIOCrypto vdev;
|
|
|
|
};
|
|
|
|
|
2011-06-14 18:51:11 +04:00
|
|
|
/* Virtio ABI version, if we increment this, we break the guest driver. */
|
|
|
|
#define VIRTIO_PCI_ABI_VERSION 0
|
|
|
|
|
2011-06-01 11:05:13 +04:00
|
|
|
#endif
|