aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-02-10 23:47:01 -0500
committerRusty Russell <rusty@rustcorp.com.au>2015-02-11 01:17:39 -0500
commit0d5b5d399f8cecfeebefdd010048b2d608eab463 (patch)
treea9d5eeea6b02d52c26b249d00a9964a68d45a7e2
parentbf6d40344d7006f29da1a2782f45188cdbbb0904 (diff)
lguest: Convert entropy device to virtio 1.0 PCI.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--tools/lguest/lguest.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index b6c88a10a4c9..842c82bd76ff 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -71,7 +71,7 @@ typedef uint8_t u8;
71#include "../../include/uapi/linux/virtio_net.h" 71#include "../../include/uapi/linux/virtio_net.h"
72#include "../../include/uapi/linux/virtio_blk.h" 72#include "../../include/uapi/linux/virtio_blk.h"
73#include <linux/virtio_console.h> 73#include <linux/virtio_console.h>
74#include <linux/virtio_rng.h> 74#include "../../include/uapi/linux/virtio_rng.h"
75#include <linux/virtio_ring.h> 75#include <linux/virtio_ring.h>
76#include "../../include/uapi/linux/virtio_pci.h" 76#include "../../include/uapi/linux/virtio_pci.h"
77#include <asm/bootparam.h> 77#include <asm/bootparam.h>
@@ -2224,7 +2224,6 @@ static void init_pci_config(struct pci_config *pci, u16 type,
2224 * 2224 *
2225 * eg : 2225 * eg :
2226 * VIRTIO_ID_CONSOLE: class = 0x07, subclass = 0x00 2226 * VIRTIO_ID_CONSOLE: class = 0x07, subclass = 0x00
2227 * VIRTIO_ID_RNG: class = 0xff, subclass = 0
2228 */ 2227 */
2229 pci->class = class; 2228 pci->class = class;
2230 pci->subclass = subclass; 2229 pci->subclass = subclass;
@@ -2816,13 +2815,16 @@ static void setup_rng(void)
2816 rng_info->rfd = open_or_die("/dev/urandom", O_RDONLY); 2815 rng_info->rfd = open_or_die("/dev/urandom", O_RDONLY);
2817 2816
2818 /* Create the new device. */ 2817 /* Create the new device. */
2819 dev = new_device("rng", VIRTIO_ID_RNG); 2818 dev = new_pci_device("rng", VIRTIO_ID_RNG, 0xff, 0);
2820 dev->priv = rng_info; 2819 dev->priv = rng_info;
2821 2820
2822 /* The device has one virtqueue, where the Guest places inbufs. */ 2821 /* The device has one virtqueue, where the Guest places inbufs. */
2823 add_virtqueue(dev, VIRTQUEUE_NUM, rng_input); 2822 add_pci_virtqueue(dev, rng_input);
2824 2823
2825 verbose("device %u: rng\n", devices.device_num++); 2824 /* We don't have any configuration space */
2825 no_device_config(dev);
2826
2827 verbose("device %u: rng\n", devices.device_num);
2826} 2828}
2827/* That's the end of device setup. */ 2829/* That's the end of device setup. */
2828 2830