From: Asias He Date: Sat, 7 Apr 2012 11:47:34 +0000 (+0800) Subject: kvm tools: Support virtio-mmio in virtio_init X-Git-Tag: next-20120411~5^2~8 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5c7d133eaf99ed513a0fd7c7101999c9ae6aa8ba;p=karo-tx-linux.git kvm tools: Support virtio-mmio in virtio_init This patch adds virtio-mmio support in virtio_init. Signed-off-by: Asias He Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/virtio/core.c b/tools/kvm/virtio/core.c index 20b90be9154f..da2749212fc6 100644 --- a/tools/kvm/virtio/core.c +++ b/tools/kvm/virtio/core.c @@ -6,6 +6,7 @@ #include "kvm/barrier.h" #include "kvm/virtio.h" #include "kvm/virtio-pci.h" +#include "kvm/virtio-mmio.h" #include "kvm/util.h" #include "kvm/kvm.h" @@ -179,6 +180,18 @@ int virtio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev, vdev->ops->exit = virtio_pci__exit; vdev->ops->init(kvm, dev, vdev, device_id, subsys_id, class); break; + case VIRTIO_MMIO: + virtio = calloc(sizeof(struct virtio_mmio), 1); + if (!virtio) + return -ENOMEM; + vdev->virtio = virtio; + vdev->ops = ops; + vdev->ops->signal_vq = virtio_mmio_signal_vq; + vdev->ops->signal_config = virtio_mmio_signal_config; + vdev->ops->init = virtio_mmio_init; + vdev->ops->exit = virtio_mmio_exit; + vdev->ops->init(kvm, dev, vdev, device_id, subsys_id, class); + break; default: return -1; };