From patchwork Mon Jun 14 20:28:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 459922 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3612861jae; Mon, 14 Jun 2021 13:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN6ceuAkU8DEydVkYL0JtasSl+T/4fqRA7Ypvf8Y528x3lr0tN7CeZPyyQZo/t5aBod2pH X-Received: by 2002:a05:6102:10c4:: with SMTP id t4mr1203372vsr.58.1623702568288; Mon, 14 Jun 2021 13:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623702568; cv=none; d=google.com; s=arc-20160816; b=ZRk3QC0UhriQFonQlsP+4QFhuJ5qYJB4sWP1EvdZxMyR7/MqfFVwUyKd9/alhqNgZO Y+5Aifn4CKM30FqMkALaA0XKSGBaZTCftHGCQ9tEhuma6dsUGyf2FGvXXuMrrVEAlVUf S7tISa6f5voSdeubq4qeG3eSjReSczhlXvbdAg8L5KsXcLC4oKz1GQF7x3AqfYHJkJFg UZbbVKe2KC0Wmy+Nq30ZWGhcfK101MiCRPj6wya4Y2OVgoAs5bk1Ju6e7blyKAFGBGwu LpKVaA0zSrhP1UdBayegrjqsSpelvw/R41kXMO74zrr3JsjEcxGtMIqDjG+/KrlTRNtG dXHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bw6uvOLKEisckETLGn7QqEllExX+W/+p46wjCLwcazI=; b=s0uEkTP9v6ze1zy1W0HaUCC1tEjKyEqddEhEdi50w0c4FzoU80ROmgZoERcHfuTkct sZmaMiWlt/9Gvq8HsVZmF5QReP2q6StWQOc8Guri5qAIDVqw+zX4jOYh14aXdqV+/law Jso0Y5dUfKCjrh0p6bKqvg87DlN+QFw6JLlSRusHbclAYV8imdQA6lQg4BF9Yh0NzilG 5hbJerI5QWynrPY2UVZs92RHZCSfag6oA1Za/yMjc+GF/TI6+YwH24Xvw7Uerd8rpi3a ppb27QzWIrgPk8RpBCypnL5cJgMrZHX1naI2HlQvm7Cao1nVMkhP+K3nROeFtNCr5wML nchg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rtpzrMif; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t16si51818uad.27.2021.06.14.13.29.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jun 2021 13:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rtpzrMif; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lstD5-0001qR-Ni for patch@linaro.org; Mon, 14 Jun 2021 16:29:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lstCa-0001jc-Mh for qemu-devel@nongnu.org; Mon, 14 Jun 2021 16:28:56 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:51985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lstCY-0005jJ-SO for qemu-devel@nongnu.org; Mon, 14 Jun 2021 16:28:56 -0400 Received: by mail-pj1-x1032.google.com with SMTP id k5so10445123pjj.1 for ; Mon, 14 Jun 2021 13:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bw6uvOLKEisckETLGn7QqEllExX+W/+p46wjCLwcazI=; b=rtpzrMifexv0tMpt5pch/6fVS/DcGS2EWxZHa7G19DKK0CqrrcXawJkLvelUGYqCEb VO/UhL1nD49Z98z3QM8nbs/wo0qpuQIvkYk4qa858sd1/KvUWLJbDufjgeFRleIqGj77 mJg04i2YSxOpJDb0ulrDEzq+5Y9QESU65kIk/JfN3VcxC+AbRNwpE1yOZ5jP8YgtvFfA rCAF6oom0WWD94anc4saGYj/jvJV4M5f5SsVGGJgpc9VoTNIiPzc7E9A1VRO/PyqZay+ oZlKFhye3ggDjRs0WyuWdus2qX7eioJhTfSyzGq7d2ir+9PdnD4JtPoBY6/7QVqgCDkZ jK+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bw6uvOLKEisckETLGn7QqEllExX+W/+p46wjCLwcazI=; b=t4S5MtVNm24bMnOrVJSdmrO4HKsT/7vi7gi5LbPsrEFJXdZh7CRO67DiaIVe2lthRx N9oO1ojChhP2NUYXgt0eiGe0NPnjepX5CCi8N5nHQo2AxgYeUJXt9B56yDDL9qwWclVE Oj1IZhGPYaRYkqGfPaci6eYKNTk1SVF/NE4MqaZNFh3JWm15E/TXCCf2AJoSByxJsM17 GroZgtpu3Sb/eQ7MPlwk/26BHqrP+tIyF+bcJSa/4dCrw0fzCS24EypgukPEgZR+UFgX fJJ1fNYXb3pA5Yu9JPUvjwOycAlmCn+KPMwsbT0XI9EieLCb8PEfmCeLlnwl4/RLXmxz JxgQ== X-Gm-Message-State: AOAM532EA3pIx0xn9ER9YC8cWpCmmCssAv0y6ZBl01+bRx+koi4Rwr53 7OzYG8/WPMBAoczIpAj1og0aAw== X-Received: by 2002:a17:90b:1285:: with SMTP id fw5mr963928pjb.35.1623702533603; Mon, 14 Jun 2021 13:28:53 -0700 (PDT) Received: from p14s.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id fs10sm289029pjb.31.2021.06.14.13.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 13:28:52 -0700 (PDT) From: Mathieu Poirier To: mst@redhat.com, alex.bennee@linaro.org Subject: [PATCH v2 4/5] docs: Add documentation for vhost based RNG implementation Date: Mon, 14 Jun 2021 14:28:41 -0600 Message-Id: <20210614202842.581640-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614202842.581640-1-mathieu.poirier@linaro.org> References: <20210614202842.581640-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=mathieu.poirier@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, stratos-dev@op-lists.linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add description and example for the vhost-user based RNG implementation. Tailored on Viresh Kumar's vhost-user-i2c documentation. Signed-off-by: Mathieu Poirier --- docs/tools/vhost-user-rng.rst | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 docs/tools/vhost-user-rng.rst -- 2.25.1 diff --git a/docs/tools/vhost-user-rng.rst b/docs/tools/vhost-user-rng.rst new file mode 100644 index 000000000000..7f69d7bb3c58 --- /dev/null +++ b/docs/tools/vhost-user-rng.rst @@ -0,0 +1,74 @@ +QEMU vhost-user-rng - RNG emulation backend +=========================================== + +Synopsis +-------- + +**vhost-user-rng** [*OPTIONS*] + +Description +----------- + +This program is a vhost-user backend that emulates a VirtIO random number +generator (RNG). It uses the host's random number generator pool, +/dev/urandom by default but configurable at will, to satisfy requests from +guests. + +This program is designed to work with QEMU's ``-device +vhost-user-rng-pci`` but should work with any virtual machine monitor +(VMM) that supports vhost-user. See the Examples section below. + +Options +------- + +.. program:: vhost-user-rng + +.. option:: -h, --help + + Print help. + +.. option:: -v, --verbose + + Increase verbosity of output + +.. option:: -s, --socket-path=PATH + + Listen on vhost-user UNIX domain socket at PATH. Incompatible with --fd. + +.. option:: -f, --fd=FDNUM + + Accept connections from vhost-user UNIX domain socket file descriptor FDNUM. + The file descriptor must already be listening for connections. + Incompatible with --socket-path. + +.. option:: -p, --period + + Rate, in milliseconds, at which the RNG hardware can generate random data. + Used in conjunction with the --max-bytes option. + +.. option:: -m, --max-bytes + + In conjuction with the --period parameter, provides the maximum number of byte + per milliseconds a RNG device can generate. + +Examples +-------- + +The daemon should be started first: + +:: + + host# vhost-user-rng --socket-path=rng.sock --period=1000 --max-bytes=4096 + +The QEMU invocation needs to create a chardev socket the device can +use to communicate as well as share the guests memory over a memfd. + +:: + + host# qemu-system \ + -chardev socket,path=$(PATH)/rng.sock,id=rng0 \ + -device vhost-user-rng-pci,chardev=rng0 \ + -m 4096 \ + -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \ + -numa node,memdev=mem \ + ...