kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: penberg@kernel.org
Cc: mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com,
	prasadjoshi124@gmail.com, kvm@vger.kernel.org,
	Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH 3/3] kvm tools: Add cmdline switch to enable virtio-rng
Date: Sat, 30 Apr 2011 16:30:25 +0300	[thread overview]
Message-ID: <1304170225-4859-3-git-send-email-levinsasha928@gmail.com> (raw)
In-Reply-To: <1304170225-4859-1-git-send-email-levinsasha928@gmail.com>

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>
---
 tools/kvm/kvm-run.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c
index 64f3409..6fd46ed 100644
--- a/tools/kvm/kvm-run.c
+++ b/tools/kvm/kvm-run.c
@@ -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;
 
-- 
1.7.5.rc3


  parent reply	other threads:[~2011-04-30 13:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-30 13:30 [PATCH 1/3] kvm tools: Lock job_mutex before signalling Sasha Levin
2011-04-30 13:30 ` [PATCH 2/3] kvm tools: Introduce virtio-rng Sasha Levin
2011-05-05  6:54   ` Ingo Molnar
2011-05-05  7:09     ` Pekka Enberg
2011-05-05  7:12       ` Ingo Molnar
2011-05-05  7:14         ` Pekka Enberg
2011-05-05  7:20           ` Sasha Levin
2011-05-05 16:04           ` Sasha Levin
2011-05-05 22:00             ` Ingo Molnar
2011-05-05  7:14         ` Ingo Molnar
2011-04-30 13:30 ` Sasha Levin [this message]
2011-05-01  7:10 ` [PATCH 1/3] kvm tools: Lock job_mutex before signalling Pekka Enberg
2011-05-01  7:43   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304170225-4859-3-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).