mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
virtio: move host_features
Move host_features from the individual transport proxies into the virtio device. Transports may continue to add feature bits during device plugging. This should it make easier to offer different sets of host features for virtio-1/transitional support. Tested-by: Shannon Zhao <shannon.zhao@linaro.org> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
2332333c97
commit
6b8f102054
11 changed files with 30 additions and 99 deletions
|
@ -80,7 +80,6 @@ typedef struct {
|
|||
SysBusDevice parent_obj;
|
||||
MemoryRegion iomem;
|
||||
qemu_irq irq;
|
||||
uint32_t host_features;
|
||||
/* Guest accessible state needing migration and reset */
|
||||
uint32_t host_features_sel;
|
||||
uint32_t guest_features_sel;
|
||||
|
@ -147,7 +146,7 @@ static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size)
|
|||
if (proxy->host_features_sel) {
|
||||
return 0;
|
||||
}
|
||||
return proxy->host_features;
|
||||
return vdev->host_features;
|
||||
case VIRTIO_MMIO_QUEUENUMMAX:
|
||||
if (!virtio_queue_get_num(vdev, vdev->queue_sel)) {
|
||||
return 0;
|
||||
|
@ -306,13 +305,6 @@ static void virtio_mmio_update_irq(DeviceState *opaque, uint16_t vector)
|
|||
qemu_set_irq(proxy->irq, level);
|
||||
}
|
||||
|
||||
static unsigned int virtio_mmio_get_features(DeviceState *opaque)
|
||||
{
|
||||
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);
|
||||
|
||||
return proxy->host_features;
|
||||
}
|
||||
|
||||
static int virtio_mmio_load_config(DeviceState *opaque, QEMUFile *f)
|
||||
{
|
||||
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);
|
||||
|
@ -348,10 +340,9 @@ static void virtio_mmio_reset(DeviceState *d)
|
|||
static void virtio_mmio_device_plugged(DeviceState *opaque)
|
||||
{
|
||||
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);
|
||||
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
||||
|
||||
virtio_add_feature(&proxy->host_features, VIRTIO_F_NOTIFY_ON_EMPTY);
|
||||
proxy->host_features = virtio_bus_get_vdev_features(&proxy->bus,
|
||||
proxy->host_features);
|
||||
virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY);
|
||||
}
|
||||
|
||||
static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
|
||||
|
@ -367,16 +358,10 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
|
|||
sysbus_init_mmio(sbd, &proxy->iomem);
|
||||
}
|
||||
|
||||
static Property virtio_mmio_properties[] = {
|
||||
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOMMIOProxy, host_features),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void virtio_mmio_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->props = virtio_mmio_properties;
|
||||
dc->realize = virtio_mmio_realizefn;
|
||||
dc->reset = virtio_mmio_reset;
|
||||
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||
|
@ -399,7 +384,6 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data)
|
|||
k->notify = virtio_mmio_update_irq;
|
||||
k->save_config = virtio_mmio_save_config;
|
||||
k->load_config = virtio_mmio_load_config;
|
||||
k->get_features = virtio_mmio_get_features;
|
||||
k->device_plugged = virtio_mmio_device_plugged;
|
||||
k->has_variable_vring_alignment = true;
|
||||
bus_class->max_dev = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue