From patchwork Sat Apr 30 13:30:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 743392 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p3UDUgtj001254 for ; Sat, 30 Apr 2011 13:30:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756872Ab1D3Naj (ORCPT ); Sat, 30 Apr 2011 09:30:39 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:58486 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756771Ab1D3Nah (ORCPT ); Sat, 30 Apr 2011 09:30:37 -0400 Received: by bwz15 with SMTP id 15so3694317bwz.19 for ; Sat, 30 Apr 2011 06:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=c6nN9pbnEFp6FnYg0gCyuj56VmZi7hu7wFaBDWoB/74=; b=lM8wE/uF7ZR142j8HQtOLSrcv9XuzWCLP3J/krffBTXx1JilCDaA8r5+1mbOnXUnFx j6oIGlQtklV+CC9cZl8n4rmIyEXnRDeCY6Mehokv00YLytjnwHPqLW3ACsJXbpTZzQvB jnM+B4wCV44e8ftSSrV30L6KDmoQCnYmAIBcg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=jtvlmL+0R08ix1yvVaJzmdFIHPGkXtEKVBuEnyBYZPTILdTjbFEZcl2juIxz57er1U ptfkzdSm0w3wV18KSYLYnsAp3fVr3ZIZS9tHY0wrvltPPWGJ+I/tud8O1IhxcZJ/zyQP 12OJKQ/mnPciX/GiKlSXYZYa4gutlOQA6La3U= Received: by 10.204.26.215 with SMTP id f23mr2156911bkc.140.1304170236610; Sat, 30 Apr 2011 06:30:36 -0700 (PDT) Received: from localhost.localdomain ([94.230.82.242]) by mx.google.com with ESMTPS id q24sm2169224bks.21.2011.04.30.06.30.35 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 30 Apr 2011 06:30:36 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 3/3] kvm tools: Add cmdline switch to enable virtio-rng Date: Sat, 30 Apr 2011 16:30:25 +0300 Message-Id: <1304170225-4859-3-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc3 In-Reply-To: <1304170225-4859-1-git-send-email-levinsasha928@gmail.com> References: <1304170225-4859-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 30 Apr 2011 13:30:42 +0000 (UTC) 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 --- 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 #include #include +#include #include #include #include @@ -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;