]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Add cmdline switch to enable virtio-rng
authorSasha Levin <levinsasha928@gmail.com>
Sat, 30 Apr 2011 13:30:25 +0000 (16:30 +0300)
committerPekka Enberg <penberg@kernel.org>
Tue, 3 May 2011 14:03:02 +0000 (17:03 +0300)
Add --virtio-rnd switch to enable virtio RNG in the guest.
Once enabled, The RNG device will be located at /dev/hwrng.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/kvm-run.c

index 64f340914151f26acf1f7983cab3816cefbc8b3b..6fd46ed17b55dd7158be23710c5e8e552acafa98 100644 (file)
@@ -19,6 +19,7 @@
 #include <kvm/virtio-blk.h>
 #include <kvm/virtio-net.h>
 #include <kvm/virtio-console.h>
+#include <kvm/virtio-rng.h>
 #include <kvm/disk-image.h>
 #include <kvm/util.h>
 #include <kvm/pci.h>
@@ -59,6 +60,7 @@ static const char *guest_mac;
 static const char *script;
 static bool single_step;
 static bool readonly_image;
+static bool virtio_rng;
 extern bool ioport_debug;
 extern int  active_console;
 
@@ -78,6 +80,8 @@ static const struct option options[] = {
                        "Don't write changes back to disk image"),
        OPT_STRING('c', "console", &console, "serial or virtio",
                        "Console to use"),
+       OPT_BOOLEAN('\0', "virtio-rng", &virtio_rng,
+                       "Enable virtio Random Number Generator"),
 
        OPT_GROUP("Kernel options:"),
        OPT_STRING('k', "kernel", &kernel_filename, "kernel",
@@ -429,6 +433,9 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 
        virtio_console__init(kvm);
 
+       if (virtio_rng)
+               virtio_rng__init(kvm);
+
        if (!network)
                network = DEFAULT_NETWORK;