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