]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Implement "host features" for virtio blk device
authorPekka Enberg <penberg@kernel.org>
Tue, 4 Jan 2011 15:13:19 +0000 (17:13 +0200)
committerPekka Enberg <penberg@kernel.org>
Tue, 4 Jan 2011 15:13:19 +0000 (17:13 +0200)
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/blk-virtio.c

index a53bdcc1975f9dc727f8a146bdc97ee53f38ee51..10dbfa23394b898bdde414607345c93a202a741a 100644 (file)
@@ -1,5 +1,6 @@
 #include "kvm/blk-virtio.h"
 
+#include "kvm/virtio_blk.h"
 #include "kvm/virtio_pci.h"
 #include "kvm/ioport.h"
 #include "kvm/kvm.h"
@@ -8,12 +9,19 @@
 #define VIRTIO_BLK_IRQ         14
 
 struct device {
+       uint32_t                host_features;
        uint32_t                guest_features;
        uint8_t                 status;
 };
 
-static struct device device;
+static struct device device = {
+       .host_features          = (1UL << VIRTIO_BLK_F_SEG_MAX)
+                               | (1UL << VIRTIO_BLK_F_GEOMETRY)
+                               | (1UL << VIRTIO_BLK_F_TOPOLOGY)
+                               | (1UL << VIRTIO_BLK_F_BLK_SIZE),
+};
 
+#include <stdio.h>
 static bool blk_virtio_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
 {
        unsigned long offset;
@@ -26,7 +34,7 @@ static bool blk_virtio_in(struct kvm *self, uint16_t port, void *data, int size,
 
        switch (offset) {
        case VIRTIO_PCI_HOST_FEATURES:
-               ioport__write32(data, 0x00);
+               ioport__write32(data, device.host_features);
                break;
        case VIRTIO_PCI_GUEST_FEATURES:
                return false;