xref: /openbmc/qemu/docs/system/devices/vhost-user-rng.rst (revision 5767815218efd3cbfd409505ed824d5f356044ae)
1 .. _vhost_user_rng:
2 
3 QEMU vhost-user-rng - RNG emulation
4 ===================================
5 
6 Background
7 ----------
8 
9 What follows builds on the material presented in vhost-user.rst - it should
10 be reviewed before moving forward with the content in this file.
11 
12 Description
13 -----------
14 
15 The vhost-user-rng device implementation was designed to work with a random
16 number generator daemon such as the one found in the vhost-device crate of
17 the rust-vmm project available on github [1].
18 
19 [1]. https://github.com/rust-vmm/vhost-device
20 
21 Examples
22 --------
23 
24 The daemon should be started first:
25 
26 ::
27 
28   host# vhost-device-rng --socket-path=rng.sock -c 1 -m 512 -p 1000
29 
30 The QEMU invocation needs to create a chardev socket the device can
31 use 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