1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:57:44 +00:00

Kernel: Add base support for VirtRNG (VirtIO based Hardware RNG)

This is a very basic implementation that only requests 4096 bytes
of entropy from the host once, but its still high quality entropy
so it should be a good fix for #4490 (boot-time entropy starvation)
for virtualized environments.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
This commit is contained in:
Idan Horowitz 2021-01-22 18:56:19 +02:00 committed by Andreas Kling
parent d1f7a2f9a5
commit e4d9fa914e
5 changed files with 144 additions and 0 deletions

View file

@ -26,6 +26,7 @@
#include <Kernel/VirtIO/VirtIO.h>
#include <Kernel/VirtIO/VirtIOConsole.h>
#include <Kernel/VirtIO/VirtIORNG.h>
namespace Kernel {
@ -41,6 +42,10 @@ void VirtIO::detect()
[[maybe_unused]] auto& unused = adopt(*new VirtIOConsole(address)).leak_ref();
break;
}
case VIRTIO_ENTROPY_PCI_DEVICE_ID: {
[[maybe_unused]] auto& unused = adopt(*new VirtIORNG(address)).leak_ref();
break;
}
default:
dbgln_if(VIRTIO_DEBUG, "VirtIO: Unknown VirtIO device with ID: {}", id.device_id);
break;