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