diff options
Diffstat (limited to 'include/hw/virtio/virtio-rng.h')
-rw-r--r-- | include/hw/virtio/virtio-rng.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index c578c00c1b..973d8095d3 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -15,6 +15,10 @@ #include "sysemu/rng.h" #include "sysemu/rng-random.h" +#define TYPE_VIRTIO_RNG "virtio-rng-device" +#define VIRTIO_RNG(obj) \ + OBJECT_CHECK(VirtIORNG, (obj), TYPE_VIRTIO_RNG) + /* The Virtio ID for the virtio rng device */ #define VIRTIO_ID_RNG 4 @@ -44,4 +48,14 @@ typedef struct VirtIORNG { int64_t quota_remaining; } VirtIORNG; +/* Set a default rate limit of 2^47 bytes per minute or roughly 2TB/s. If + you have an entropy source capable of generating more entropy than this + and you can pass it through via virtio-rng, then hats off to you. Until + then, this is unlimited for all practical purposes. +*/ +#define DEFINE_VIRTIO_RNG_PROPERTIES(_state, _conf_field) \ + DEFINE_PROP_UINT64("max-bytes", _state, _conf_field.max_bytes, \ + INT64_MAX), \ + DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 1 << 16) + #endif |