1.. _vhost_user_rng:
2
3QEMU vhost-user-rng - RNG emulation
4===================================
5
6Background
7----------
8
9What follows builds on the material presented in vhost-user.rst - it should
10be reviewed before moving forward with the content in this file.
11
12Description
13-----------
14
15The vhost-user-rng device implementation was designed to work with a random
16number generator daemon such as the one found in the vhost-device crate of
17the rust-vmm project available on github [1].
18
19[1]. https://github.com/rust-vmm/vhost-device
20
21Examples
22--------
23
24The daemon should be started first:
25
26::
27
28  host# vhost-device-rng --socket-path=rng.sock -c 1 -m 512 -p 1000
29
30The QEMU invocation needs to create a chardev socket the device can
31use to communicate as well as share the guests memory over a memfd.
32
33::
34
35  host# qemu-system								\
36      -chardev socket,path=$(PATH)/rng.sock,id=rng0				\
37      -device vhost-user-rng-pci,chardev=rng0					\
38      -m 4096 									\
39      -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on	\
40      -numa node,memdev=mem							\
41      ...
42