2011-06-01 09:05:13 +02: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-14 22:52:02 +01:00
|
|
|
#include "hw/pci/msi.h"
|
2013-02-05 17:06:20 +01: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 12:34:41 +02:00
|
|
|
#include "hw/virtio/virtio-input.h"
|
2014-09-10 14:20:34 +02:00
|
|
|
#include "hw/virtio/virtio-gpu.h"
|
2016-10-28 10:33:25 +02:00
|
|
|
#include "hw/virtio/virtio-crypto.h"
|
2017-03-02 19:25:52 +01: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 02:53:32 +01:00
|
|
|
#if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX)
|
|
|
|
#include "hw/virtio/vhost-user-blk.h"
|
|
|
|
#endif
|
2016-10-28 10:33:25 +02:00
|
|
|
|
2013-04-23 11:08:41 +02:00
|
|
|
#ifdef CONFIG_VIRTFS
|
|
|
|
#include "hw/9pfs/virtio-9p.h"
|
|
|
|
#endif
|
2013-03-29 02:08:16 +01:00
|
|
|
#ifdef CONFIG_VHOST_SCSI
|
|
|
|
#include "hw/virtio/vhost-scsi.h"
|
|
|
|
#endif
|
2016-08-16 14:27:22 +02:00
|
|
|
#ifdef CONFIG_VHOST_VSOCK
|
|
|
|
#include "hw/virtio/vhost-vsock.h"
|
|
|
|
#endif
|
2013-01-15 00:08:03 +01:00
|
|
|
|
2013-01-15 00:08:04 +01:00
|
|
|
typedef struct VirtIOPCIProxy VirtIOPCIProxy;
|
2013-03-18 17:37:23 +01:00
|
|
|
typedef struct VirtIOBlkPCI VirtIOBlkPCI;
|
2013-03-21 15:15:15 +01:00
|
|
|
typedef struct VirtIOSCSIPCI VirtIOSCSIPCI;
|
2013-03-27 10:49:11 +01:00
|
|
|
typedef struct VirtIOBalloonPCI VirtIOBalloonPCI;
|
2013-04-09 14:53:31 +02:00
|
|
|
typedef struct VirtIOSerialPCI VirtIOSerialPCI;
|
2013-04-11 16:29:58 +02:00
|
|
|
typedef struct VirtIONetPCI VirtIONetPCI;
|
2013-03-29 02:08:16 +01:00
|
|
|
typedef struct VHostSCSIPCI VHostSCSIPCI;
|
2017-03-02 19:25:52 +01: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 02:53:32 +01:00
|
|
|
typedef struct VHostUserBlkPCI VHostUserBlkPCI;
|
2013-04-24 10:07:56 +02:00
|
|
|
typedef struct VirtIORngPCI VirtIORngPCI;
|
2015-06-04 12:34:41 +02:00
|
|
|
typedef struct VirtIOInputPCI VirtIOInputPCI;
|
2015-06-04 12:34:42 +02:00
|
|
|
typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI;
|
2014-03-28 09:18:47 +01:00
|
|
|
typedef struct VirtIOInputHostPCI VirtIOInputHostPCI;
|
2014-09-10 14:20:34 +02:00
|
|
|
typedef struct VirtIOGPUPCI VirtIOGPUPCI;
|
2016-08-16 14:27:22 +02:00
|
|
|
typedef struct VHostVSockPCI VHostVSockPCI;
|
2016-10-28 10:33:25 +02:00
|
|
|
typedef struct VirtIOCryptoPCI VirtIOCryptoPCI;
|
2013-01-15 00:08:04 +01:00
|
|
|
|
2013-01-15 00:08:03 +01: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 09:05:13 +02:00
|
|
|
|
2016-02-10 14:31:13 +01: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 17:02:25 +02:00
|
|
|
VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT,
|
2016-12-30 11:09:15 +01:00
|
|
|
VIRTIO_PCI_FLAG_ATS_BIT,
|
2017-02-20 21:43:11 +01:00
|
|
|
VIRTIO_PCI_FLAG_INIT_DEVERR_BIT,
|
2017-02-20 21:43:12 +01:00
|
|
|
VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
|
2017-02-20 21:43:13 +01:00
|
|
|
VIRTIO_PCI_FLAG_INIT_PM_BIT,
|
2016-02-10 14:31:13 +01:00
|
|
|
};
|
|
|
|
|
2014-10-14 18:40:06 +02: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 15:41:23 +02: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 12:34:26 +02:00
|
|
|
/* virtio version flags */
|
2015-11-10 12:41:29 +01:00
|
|
|
#define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
|
2015-06-04 12:34:26 +02:00
|
|
|
|
2015-11-06 09:02:44 +01:00
|
|
|
/* migrate extra state */
|
|
|
|
#define VIRTIO_PCI_FLAG_MIGRATE_EXTRA (1 << VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT)
|
|
|
|
|
2015-11-06 09:02:48 +01: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 17:02:25 +02: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 11:09:15 +01:00
|
|
|
/* address space translation service */
|
|
|
|
#define VIRTIO_PCI_FLAG_ATS (1 << VIRTIO_PCI_FLAG_ATS_BIT)
|
|
|
|
|
2017-02-20 21:43:11 +01:00
|
|
|
/* Init error enabling flags */
|
|
|
|
#define VIRTIO_PCI_FLAG_INIT_DEVERR (1 << VIRTIO_PCI_FLAG_INIT_DEVERR_BIT)
|
|
|
|
|
2017-02-20 21:43:12 +01:00
|
|
|
/* Init Link Control register */
|
|
|
|
#define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
|
|
|
|
|
2017-02-20 21:43:13 +01:00
|
|
|
/* Init Power Management */
|
|
|
|
#define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
|
|
|
|
|
2012-05-17 15:32:39 +02:00
|
|
|
typedef struct {
|
2012-12-20 23:27:54 +01:00
|
|
|
MSIMessage msg;
|
2012-05-17 15:32:39 +02:00
|
|
|
int virq;
|
|
|
|
unsigned int users;
|
|
|
|
} VirtIOIRQFD;
|
|
|
|
|
2013-01-15 00:08:04 +01: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 18:49:07 +01:00
|
|
|
DeviceRealize parent_dc_realize;
|
2015-02-27 14:52:14 +01:00
|
|
|
void (*realize)(VirtIOPCIProxy *vpci_dev, Error **errp);
|
2013-01-15 00:08:04 +01:00
|
|
|
} VirtioPCIClass;
|
|
|
|
|
2015-06-04 12:34:33 +02:00
|
|
|
typedef struct VirtIOPCIRegion {
|
|
|
|
MemoryRegion mr;
|
2015-06-04 12:34:35 +02:00
|
|
|
uint32_t offset;
|
2015-06-04 12:34:39 +02:00
|
|
|
uint32_t size;
|
2015-06-04 12:34:37 +02:00
|
|
|
uint32_t type;
|
2015-06-04 12:34:33 +02:00
|
|
|
} VirtIOPCIRegion;
|
|
|
|
|
2015-11-06 09:02:44 +01: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 00:08:04 +01:00
|
|
|
struct VirtIOPCIProxy {
|
2011-06-01 09:05:13 +02:00
|
|
|
PCIDevice pci_dev;
|
2011-08-08 15:09:13 +02:00
|
|
|
MemoryRegion bar;
|
2017-10-09 05:19:41 +02:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
VirtIOPCIRegion common;
|
|
|
|
VirtIOPCIRegion isr;
|
|
|
|
VirtIOPCIRegion device;
|
|
|
|
VirtIOPCIRegion notify;
|
|
|
|
VirtIOPCIRegion notify_pio;
|
|
|
|
};
|
|
|
|
VirtIOPCIRegion regs[5];
|
|
|
|
};
|
2015-06-04 12:34:22 +02:00
|
|
|
MemoryRegion modern_bar;
|
2015-11-06 09:02:48 +01:00
|
|
|
MemoryRegion io_bar;
|
2016-09-29 06:04:40 +02: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 14:59:49 +02:00
|
|
|
int config_cap;
|
2011-06-01 09:05:13 +02:00
|
|
|
uint32_t flags;
|
2016-07-20 17:28:21 +02:00
|
|
|
bool disable_modern;
|
2016-12-14 17:30:35 +01:00
|
|
|
bool ignore_backend_features;
|
2016-07-20 17:28:21 +02:00
|
|
|
OnOffAuto disable_legacy;
|
2011-06-01 09:05:13 +02:00
|
|
|
uint32_t class_code;
|
|
|
|
uint32_t nvectors;
|
2015-06-04 12:34:22 +02:00
|
|
|
uint32_t dfselect;
|
|
|
|
uint32_t gfselect;
|
|
|
|
uint32_t guest_features[2];
|
2015-11-06 09:02:44 +01:00
|
|
|
VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
|
2015-06-04 12:34:22 +02:00
|
|
|
|
2012-05-17 15:32:39 +02:00
|
|
|
VirtIOIRQFD *vector_irqfd;
|
2012-12-20 13:28:58 +01:00
|
|
|
int nvqs_with_notifiers;
|
2013-01-15 00:08:04 +01:00
|
|
|
VirtioBusState bus;
|
|
|
|
};
|
2011-06-01 09:05:13 +02:00
|
|
|
|
2016-07-20 17:28:21 +02: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 15:15:15 +01:00
|
|
|
|
2016-09-13 15:30:30 +02:00
|
|
|
static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)
|
|
|
|
{
|
|
|
|
proxy->disable_modern = true;
|
|
|
|
}
|
|
|
|
|
2013-03-21 15:15:15 +01: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 02:08:16 +01: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 19:25:52 +01: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 02:53:32 +01: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 17:37:23 +01: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 10:49:11 +01: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 14:53:31 +02: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 16:29:58 +02: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 11:08:41 +02: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 10:29:37 +01:00
|
|
|
V9fsVirtioState vdev;
|
2013-04-23 11:08:41 +02:00
|
|
|
} V9fsPCIState;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-04-24 10:07:56 +02: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 12:34:41 +02: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 12:34:42 +02: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 18:11:40 +02:00
|
|
|
#ifdef CONFIG_LINUX
|
|
|
|
|
2014-03-28 09:18:47 +01: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 18:11:40 +02:00
|
|
|
#endif
|
|
|
|
|
2014-09-10 14:20:34 +02: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 14:27:22 +02: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 10:33:25 +02: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 16:51:11 +02:00
|
|
|
/* Virtio ABI version, if we increment this, we break the guest driver. */
|
|
|
|
#define VIRTIO_PCI_ABI_VERSION 0
|
|
|
|
|
2011-06-01 09:05:13 +02:00
|
|
|
#endif
|