aboutsummaryrefslogtreecommitdiff
path: root/hw/syborg_virtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/syborg_virtio.c')
-rw-r--r--hw/syborg_virtio.c13
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(),
}
};