diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-01-10 13:52:53 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-11 13:40:59 -0600 |
commit | 8172539d21a03e982aa7f139ddc1607dc1422045 (patch) | |
tree | 67ceb2ca2ea245060d9285623e26e3a42b3cdc1a /hw/syborg_virtio.c | |
parent | 704a76fcd24372a683652651b4597f6654084975 (diff) | |
download | qemu-8172539d21a03e982aa7f139ddc1607dc1422045.zip qemu-8172539d21a03e982aa7f139ddc1607dc1422045.tar.gz qemu-8172539d21a03e982aa7f139ddc1607dc1422045.tar.bz2 |
virtio: add features as qdev properties
Add feature bits as properties to virtio. This makes it possible to e.g. define
machine without indirect buffer support, which is required for 0.10
compatibility, or without hardware checksum support, which is required for 0.11
compatibility. Since default values for optional features are now set by qdev,
get_features callback has been modified: it sets non-optional bits, and clears
bits not supported by host.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/syborg_virtio.c')
-rw-r--r-- | hw/syborg_virtio.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c index fe6fc23..65239a0 100644 --- a/hw/syborg_virtio.c +++ b/hw/syborg_virtio.c @@ -25,6 +25,7 @@ #include "syborg.h" #include "sysbus.h" #include "virtio.h" +#include "virtio-net.h" #include "sysemu.h" //#define DEBUG_SYBORG_VIRTIO @@ -66,6 +67,7 @@ typedef struct { uint32_t int_enable; uint32_t id; NICConf nic; + uint32_t host_features; } SyborgVirtIOProxy; static uint32_t syborg_virtio_readl(void *opaque, target_phys_addr_t offset) @@ -86,8 +88,7 @@ static uint32_t syborg_virtio_readl(void *opaque, target_phys_addr_t offset) ret = s->id; break; case SYBORG_VIRTIO_HOST_FEATURES: - ret = vdev->get_features(vdev); - ret |= vdev->binding->get_features(s); + ret = s->host_features; break; case SYBORG_VIRTIO_GUEST_FEATURES: ret = vdev->guest_features; @@ -244,9 +245,8 @@ static void syborg_virtio_update_irq(void *opaque, uint16_t vector) static unsigned syborg_virtio_get_features(void *opaque) { - unsigned ret = 0; - ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY); - return ret; + SyborgVirtIOProxy *proxy = opaque; + return proxy->host_features; } static VirtIOBindings syborg_virtio_bindings = { @@ -272,6 +272,8 @@ static int syborg_virtio_init(SyborgVirtIOProxy *proxy, VirtIODevice *vdev) qemu_register_reset(virtio_reset, vdev); virtio_bind_device(vdev, &syborg_virtio_bindings, proxy); + proxy->host_features |= (0x1 << VIRTIO_F_NOTIFY_ON_EMPTY); + proxy->host_features = vdev->get_features(vdev, proxy->host_features); return 0; } @@ -292,6 +294,7 @@ static SysBusDeviceInfo syborg_virtio_net_info = { .qdev.size = sizeof(SyborgVirtIOProxy), .qdev.props = (Property[]) { DEFINE_NIC_PROPERTIES(SyborgVirtIOProxy, nic), + DEFINE_VIRTIO_NET_FEATURES(SyborgVirtIOProxy, host_features), DEFINE_PROP_END_OF_LIST(), } }; |