search for: virtrng_info

Displaying 20 results from an estimated 54 matches for "virtrng_info".

2014 Apr 25
1
[PATCH] virtio-rng: support multiple virtio-rng devices
...ivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -25,88 +25,108 @@ #include <linux/virtio_rng.h> #include <linux/module.h> -static struct virtqueue *vq; -static unsigned int data_avail; -static DECLARE_COMPLETION(have_data); -static bool busy; + +struct virtrng_info { + struct virtio_device *vdev; + struct hwrng hwrng; + struct virtqueue *vq; + unsigned int data_avail; + struct completion have_data; + bool busy; +}; static void random_recv_done(struct virtqueue *vq) { + struct virtrng_info *vi = vq->vdev->priv; + /* We can get spurious callbacks, e...
2014 Apr 25
1
[PATCH] virtio-rng: support multiple virtio-rng devices
...ivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -25,88 +25,108 @@ #include <linux/virtio_rng.h> #include <linux/module.h> -static struct virtqueue *vq; -static unsigned int data_avail; -static DECLARE_COMPLETION(have_data); -static bool busy; + +struct virtrng_info { + struct virtio_device *vdev; + struct hwrng hwrng; + struct virtqueue *vq; + unsigned int data_avail; + struct completion have_data; + bool busy; +}; static void random_recv_done(struct virtqueue *vq) { + struct virtrng_info *vi = vq->vdev->priv; + /* We can get spurious callbacks, e...
2023 Jan 20
0
[PATCH 1/2] virtio-rng: implement entropy leak feature
...lude <linux/spinlock.h> > #include <linux/virtio.h> > #include <linux/virtio_rng.h> > +#include <linux/random.h> > #include <linux/module.h> > #include <linux/slab.h> > > @@ -18,6 +20,12 @@ static DEFINE_IDA(rng_index_ida); > struct virtrng_info { > struct hwrng hwrng; > struct virtqueue *vq; > + /* Leak queues */ > + bool has_leakqs; > + struct virtqueue *leakq[2]; > + spinlock_t lock; > + int active_leakq; > + > char name[25]; > int index; > bool hwrng_register_done; > @@ -29,27 +37,159 @@ st...
2014 Jul 21
4
[PATCH 0/3] virtio-rng: contribute to early randomness requests
Hi, This series enables virtio-rng to service the early randomness requests made by the hwrng core (patch 2), with Herbert's idea of using the scan routine. Patch 3 reverts the previous restriction, which no longer applies, to not send read requests to the host before successful probe. Patch 1 is a minor cleanup. Please review and apply, Amit Shah (3): virtio: rng: remove unused struct
2014 Jul 21
4
[PATCH 0/3] virtio-rng: contribute to early randomness requests
Hi, This series enables virtio-rng to service the early randomness requests made by the hwrng core (patch 2), with Herbert's idea of using the scan routine. Patch 3 reverts the previous restriction, which no longer applies, to not send read requests to the host before successful probe. Patch 1 is a minor cleanup. Please review and apply, Amit Shah (3): virtio: rng: remove unused struct
2014 Aug 06
2
[PATCH] virtio-rng: complete have_data completion in removing device
On (Wed) 06 Aug 2014 [16:05:41], Amos Kong wrote: > On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote: > > When we try to hot-remove a busy virtio-rng device from QEMU monitor, > > the device can't be hot-removed. Because virtio-rng driver hangs at > > wait_for_completion_killable(). > > > > This patch fixed the hang by completing have_data completion
2014 Aug 06
2
[PATCH] virtio-rng: complete have_data completion in removing device
On (Wed) 06 Aug 2014 [16:05:41], Amos Kong wrote: > On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote: > > When we try to hot-remove a busy virtio-rng device from QEMU monitor, > > the device can't be hot-removed. Because virtio-rng driver hangs at > > wait_for_completion_killable(). > > > > This patch fixed the hang by completing have_data completion
2014 Jul 21
8
[PATCH v2 0/4] virtio-rng: contribute to early randomness requests
v2: - update patch 3 to store the hwrng_register_done bool per-device rather than global - add patch 2 that re-arranges struct elems for better packing. Hi, This series enables virtio-rng to service the early randomness requests made by the hwrng core (patch 3), with Herbert's idea of using the scan routine. Patch 4 reverts the previous restriction, which no longer applies, to not send
2014 Jul 21
8
[PATCH v2 0/4] virtio-rng: contribute to early randomness requests
v2: - update patch 3 to store the hwrng_register_done bool per-device rather than global - add patch 2 that re-arranges struct elems for better packing. Hi, This series enables virtio-rng to service the early randomness requests made by the hwrng core (patch 3), with Herbert's idea of using the scan routine. Patch 4 reverts the previous restriction, which no longer applies, to not send
2014 Aug 12
3
[3.16 stable PATCH v2 1/2] virtio: rng: delay hwrng_register() till driver is ready
...+++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index e9b15bc..f4e04f3 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -36,6 +36,7 @@ struct virtrng_info { bool busy; char name[25]; int index; + bool hwrng_register_done; }; static bool probe_done; @@ -137,15 +138,6 @@ static int probe_common(struct virtio_device *vdev) return err; } - err = hwrng_register(&vi->hwrng); - if (err) { - vdev->config->del_vqs(vdev); - vi-&...
2014 Aug 12
3
[3.16 stable PATCH v2 1/2] virtio: rng: delay hwrng_register() till driver is ready
...+++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index e9b15bc..f4e04f3 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -36,6 +36,7 @@ struct virtrng_info { bool busy; char name[25]; int index; + bool hwrng_register_done; }; static bool probe_done; @@ -137,15 +138,6 @@ static int probe_common(struct virtio_device *vdev) return err; } - err = hwrng_register(&vi->hwrng); - if (err) { - vdev->config->del_vqs(vdev); - vi-&...
2014 Jul 05
6
[PATCH v2 0/2] hwrng, virtio-rng: init-time fixes
v2: - this now separates both the patches; the virtio-rng fix is self-contained - re-work hwrng core to fetch randomness at device init time if ->init() is registered by the device, instead of not calling it at all. - virtio-rng: introduce a probe_done bool to ensure we don't ask host for data before successful probe Hi, When booting a recent kernel under KVM with the virtio-rng
2014 Jul 05
6
[PATCH v2 0/2] hwrng, virtio-rng: init-time fixes
v2: - this now separates both the patches; the virtio-rng fix is self-contained - re-work hwrng core to fetch randomness at device init time if ->init() is registered by the device, instead of not calling it at all. - virtio-rng: introduce a probe_done bool to ensure we don't ask host for data before successful probe Hi, When booting a recent kernel under KVM with the virtio-rng
2014 Sep 08
0
[PATCH] virtio-rng: complete have_data completion in removing device
...ssary. Test results: hotplug issue disappeared (dd process will quit). diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 2e3139e..028797c 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -35,6 +35,7 @@ struct virtrng_info { unsigned int data_avail; int index; bool busy; + bool remove; bool hwrng_register_done; }; @@ -68,6 +69,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) int ret; struct virtrng_info *vi = (struct virtrng_in...
2014 Sep 10
4
[PATCH v3 0/2] virtio-rng: fix hotunplug
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1121540 When we try to hot-unplugging a busy virtio-rng device, the device can't be removed. And the reading process in guest gets stuck. Those two patches fixed this issue by completing have_data completion and preventing invalid reading. Thanks for the help of Amit. Cc: stable at vger.kernel.org V2: reset data_avail (Amit) adjust
2014 Sep 10
4
[PATCH v3 0/2] virtio-rng: fix hotunplug
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1121540 When we try to hot-unplugging a busy virtio-rng device, the device can't be removed. And the reading process in guest gets stuck. Those two patches fixed this issue by completing have_data completion and preventing invalid reading. Thanks for the help of Amit. Cc: stable at vger.kernel.org V2: reset data_avail (Amit) adjust
2014 Sep 10
0
[PATCH v3 2/2] virtio-rng: skip reading when we start to remove the device
...s/char/hw_random/virtio-rng.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 849b228..132c9cc 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -36,6 +36,7 @@ struct virtrng_info { int index; bool busy; bool hwrng_register_done; + bool hwrng_removed; }; @@ -68,6 +69,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) int ret; struct virtrng_info *vi = (struct virtrng_info *)rng->priv; + if (vi->hwrng_removed) + return -E...
2014 Jul 05
0
[PATCH v2 2/2] virtio: rng: ensure reads happen after successful probe
...1); if (bytes_read > 0) add_device_randomness(bytes, bytes_read); diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index f3e7150..157f27c 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -38,6 +38,8 @@ struct virtrng_info { int index; }; +bool probe_done; + static void random_recv_done(struct virtqueue *vq) { struct virtrng_info *vi = vq->vdev->priv; @@ -67,6 +69,13 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) int ret; struct virtrng_info *vi = (struct virtrng_in...
2014 Aug 12
3
[3.16 stable PATCH 1/2] virtio: rng: delay hwrng_register() till driver is ready
...+++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index e9b15bc..f4e04f3 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -36,6 +36,7 @@ struct virtrng_info { bool busy; char name[25]; int index; + bool hwrng_register_done; }; static bool probe_done; @@ -137,15 +138,6 @@ static int probe_common(struct virtio_device *vdev) return err; } - err = hwrng_register(&vi->hwrng); - if (err) { - vdev->config->del_vqs(vdev); - vi-&...
2014 Aug 12
3
[3.16 stable PATCH 1/2] virtio: rng: delay hwrng_register() till driver is ready
...+++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index e9b15bc..f4e04f3 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -36,6 +36,7 @@ struct virtrng_info { bool busy; char name[25]; int index; + bool hwrng_register_done; }; static bool probe_done; @@ -137,15 +138,6 @@ static int probe_common(struct virtio_device *vdev) return err; } - err = hwrng_register(&vi->hwrng); - if (err) { - vdev->config->del_vqs(vdev); - vi-&...