VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
VirtIODevice *vdev;
+ if (proxy->rng.rng == NULL) {
+ proxy->rng.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));
+
+ object_property_add_child(OBJECT(pci_dev),
+ "default-backend",
+ OBJECT(proxy->rng.default_backend),
+ NULL);
+
+ object_property_set_link(OBJECT(pci_dev),
+ OBJECT(proxy->rng.default_backend),
+ "rng", NULL);
+ }
+
vdev = virtio_rng_init(&pci_dev->qdev, &proxy->rng);
if (!vdev) {
return -1;
#define _QEMU_VIRTIO_RNG_H
#include "qemu/rng.h"
+#include "qemu/rng-random.h"
/* The Virtio ID for the virtio rng device */
#define VIRTIO_ID_RNG 4
RngBackend *rng;
uint64_t max_bytes;
uint32_t period_ms;
+ RndRandom *default_backend;
};
#endif