]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Add guest compatability warning to virtio-rng
authorSasha Levin <levinsasha928@gmail.com>
Thu, 18 Aug 2011 12:18:32 +0000 (15:18 +0300)
committerPekka Enberg <penberg@kernel.org>
Fri, 19 Aug 2011 16:13:48 +0000 (19:13 +0300)
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/virtio/rng.c

index c8b827ab5349c4f266a836a0293c181306097f8f..93258f6fcb66525eaa4ee0b2677286f392b017f5 100644 (file)
@@ -11,6 +11,7 @@
 #include "kvm/threadpool.h"
 #include "kvm/irq.h"
 #include "kvm/ioeventfd.h"
+#include "kvm/guest_compat.h"
 
 #include <linux/virtio_ring.h>
 #include <linux/virtio_rng.h>
@@ -41,6 +42,7 @@ struct rng_dev {
        int                     fd;
        u32                     vq_vector[NUM_VIRT_QUEUES];
        u32                     msix_io_block;
+       int                     compat_id;
 
        /* virtio queue */
        u16                     queue_selector;
@@ -137,6 +139,8 @@ static bool virtio_rng_pci_io_out(struct ioport *ioport, struct kvm *kvm, u16 po
                struct rng_dev_job *job;
                void *p;
 
+               compat__remove_message(rdev->compat_id);
+
                queue                   = &rdev->vqs[rdev->queue_selector];
                queue->pfn              = ioport__read32(data);
                p                       = guest_pfn_to_host(kvm, queue->pfn);
@@ -279,6 +283,12 @@ void virtio_rng__init(struct kvm *kvm)
 
                ioeventfd__add_event(&ioevent);
        }
+
+       rdev->compat_id = compat__add_message("virtio-rng device was not detected",
+                                               "While you have requested a virtio-rng device, "
+                                               "the guest kernel didn't seem to detect it.\n"
+                                               "Please make sure that the kernel was compiled"
+                                               "with CONFIG_HW_RANDOM_VIRTIO.");
 }
 
 void virtio_rng__delete_all(struct kvm *kvm)