]> git.ipfire.org Git - thirdparty/qemu.git/blame - include/hw/virtio/virtio-rng.h
hw: move headers to include/
[thirdparty/qemu.git] / include / hw / virtio / virtio-rng.h
CommitLineData
16c915ba
AS
1/*
2 * Virtio RNG Support
3 *
4 * Copyright Red Hat, Inc. 2012
5 * Copyright Amit Shah <amit.shah@redhat.com>
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or
8 * (at your option) any later version. See the COPYING file in the
9 * top-level directory.
10 */
11
12#ifndef _QEMU_VIRTIO_RNG_H
13#define _QEMU_VIRTIO_RNG_H
14
15#include "qemu/rng.h"
500054f1 16#include "qemu/rng-random.h"
16c915ba
AS
17
18/* The Virtio ID for the virtio rng device */
19#define VIRTIO_ID_RNG 4
20
21struct VirtIORNGConf {
22 RngBackend *rng;
904d6f58
AL
23 uint64_t max_bytes;
24 uint32_t period_ms;
500054f1 25 RndRandom *default_backend;
16c915ba
AS
26};
27
f1b24e84
FK
28typedef struct VirtIORNG {
29 VirtIODevice vdev;
30
31 DeviceState *qdev;
32
33 /* Only one vq - guest puts buffer(s) on it when it needs entropy */
34 VirtQueue *vq;
35
36 VirtIORNGConf *conf;
37
38 RngBackend *rng;
39
40 /* We purposefully don't migrate this state. The quota will reset on the
41 * destination as a result. Rate limiting is host state, not guest state.
42 */
43 QEMUTimer *rate_limit_timer;
44 int64_t quota_remaining;
45} VirtIORNG;
46
16c915ba 47#endif