search for: register_buff

Displaying 20 results from an estimated 34 matches for "register_buff".

Did you mean: register_buffer
2014 Apr 25
1
[PATCH] virtio-rng: support multiple virtio-rng devices
...Qs + virtio_pci. */ - if (!virtqueue_get_buf(vq, &data_avail)) + if (!virtqueue_get_buf(vi->vq, &vi->data_avail)) return; - complete(&have_data); + complete(&vi->have_data); } /* The host will fill any buffer we give it with sweet, sweet randomness. */ -static void register_buffer(u8 *buf, size_t size) +static void register_buffer(struct virtrng_info *vi, u8 *buf, size_t size) { struct scatterlist sg; sg_init_one(&sg, buf, size); /* There should always be room for one buffer. */ - virtqueue_add_inbuf(vq, &sg, 1, buf, GFP_KERNEL); + virtqueue_add_inbuf(vi...
2014 Apr 25
1
[PATCH] virtio-rng: support multiple virtio-rng devices
...Qs + virtio_pci. */ - if (!virtqueue_get_buf(vq, &data_avail)) + if (!virtqueue_get_buf(vi->vq, &vi->data_avail)) return; - complete(&have_data); + complete(&vi->have_data); } /* The host will fill any buffer we give it with sweet, sweet randomness. */ -static void register_buffer(u8 *buf, size_t size) +static void register_buffer(struct virtrng_info *vi, u8 *buf, size_t size) { struct scatterlist sg; sg_init_one(&sg, buf, size); /* There should always be room for one buffer. */ - virtqueue_add_inbuf(vq, &sg, 1, buf, GFP_KERNEL); + virtqueue_add_inbuf(vi...
2007 Dec 21
0
[kvm-devel] [Virtio-for-kvm] [PATCH 2/13] [Mostly resend] virtio additions
...t virtqueue *vq; +static u32 random_data; +static bool have_data; + +static bool random_recv_done(struct virtqueue *vq) +{ + have_data = true; + + /* Don't suppress callbacks: there can't be any more since we + * have used up the only buffer. */ + return true; +} + +static void register_buffer(void) +{ + struct scatterlist sg; + + sg_init_one(&sg, &random_data, sizeof(random_data)); + /* There should always be room for one buffer. */ + if (vq->vq_ops->add_buf(vq, &sg, 0, 1, &random_data) != 0) + BUG(); + vq->vq_ops->kick(vq); +} + +stat...
2007 Dec 21
0
[kvm-devel] [Virtio-for-kvm] [PATCH 2/13] [Mostly resend] virtio additions
...t virtqueue *vq; +static u32 random_data; +static bool have_data; + +static bool random_recv_done(struct virtqueue *vq) +{ + have_data = true; + + /* Don't suppress callbacks: there can't be any more since we + * have used up the only buffer. */ + return true; +} + +static void register_buffer(void) +{ + struct scatterlist sg; + + sg_init_one(&sg, &random_data, sizeof(random_data)); + /* There should always be room for one buffer. */ + if (vq->vq_ops->add_buf(vq, &sg, 0, 1, &random_data) != 0) + BUG(); + vq->vq_ops->kick(vq); +} + +stat...
2008 May 26
1
[PATCH] virtio_rng: dont use vmalloced addresses for virtio
....c @@ -27,7 +27,7 @@ * give it 64 bytes at a time, and the hwrng framework takes it 4 bytes at a * time. */ static struct virtqueue *vq; -static u32 random_data[16]; +static u32 *random_data; static unsigned int data_left; static DECLARE_COMPLETION(have_data); @@ -47,9 +47,9 @@ static void register_buffer(void) { struct scatterlist sg; - sg_init_one(&sg, &random_data, sizeof(random_data)); + sg_init_one(&sg, random_data, 64); /* There should always be room for one buffer. */ - if (vq->vq_ops->add_buf(vq, &sg, 0, 1, &random_data) != 0) + if (vq->vq_ops->add_bu...
2008 May 26
1
[PATCH] virtio_rng: dont use vmalloced addresses for virtio
....c @@ -27,7 +27,7 @@ * give it 64 bytes at a time, and the hwrng framework takes it 4 bytes at a * time. */ static struct virtqueue *vq; -static u32 random_data[16]; +static u32 *random_data; static unsigned int data_left; static DECLARE_COMPLETION(have_data); @@ -47,9 +47,9 @@ static void register_buffer(void) { struct scatterlist sg; - sg_init_one(&sg, &random_data, sizeof(random_data)); + sg_init_one(&sg, random_data, 64); /* There should always be room for one buffer. */ - if (vq->vq_ops->add_buf(vq, &sg, 0, 1, &random_data) != 0) + if (vq->vq_ops->add_bu...
2020 Aug 11
3
[PATCH v3] virtio-rng: return available data with O_NONBLOCK
...m/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c > index a90001e02bf7..8eaeceecb41e 100644 > --- a/drivers/char/hw_random/virtio-rng.c > +++ b/drivers/char/hw_random/virtio-rng.c > @@ -65,7 +65,7 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) > register_buffer(vi, buf, size); > } > > - if (!wait) > + if (!wait && !completion_done(&vi->have_data)) > return 0; > > ret = wait_for_completion_killable(&vi->have_data); > @@ -74,7 +74,7 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size...
2020 Aug 11
3
[PATCH v3] virtio-rng: return available data with O_NONBLOCK
...m/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c > index a90001e02bf7..8eaeceecb41e 100644 > --- a/drivers/char/hw_random/virtio-rng.c > +++ b/drivers/char/hw_random/virtio-rng.c > @@ -65,7 +65,7 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) > register_buffer(vi, buf, size); > } > > - if (!wait) > + if (!wait && !completion_done(&vi->have_data)) > return 0; > > ret = wait_for_completion_killable(&vi->have_data); > @@ -74,7 +74,7 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size...
2017 Sep 26
0
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
...wait) { int ret; struct virtrng_info *vi = (struct virtrng_info *)rng->priv; if (vi->hwrng_removed) return -ENODEV; if (!vi->busy) { vi->busy = true; init_completion(&vi->have_data); register_buffer(vi, buf, size); } if (!wait) return 0; ret = wait_for_completion_killable(&vi->have_data); if (ret < 0) return ret; vi->busy = false; return vi->data_avail; } > > > if (!...
2008 Jan 14
1
[PATCH] virtio_rng: adopt driver to newest virtio code
...ueue *vq) +static void random_recv_done(struct virtqueue *vq) { have_data = true; - /* Don't suppress callbacks: there can't be any more since we + /* No need to call disable_cb: there can't be any more since we * have used up the only buffer. */ - return true; } static void register_buffer(void)
2008 Jan 14
1
[PATCH] virtio_rng: adopt driver to newest virtio code
...ueue *vq) +static void random_recv_done(struct virtqueue *vq) { have_data = true; - /* Don't suppress callbacks: there can't be any more since we + /* No need to call disable_cb: there can't be any more since we * have used up the only buffer. */ - return true; } static void register_buffer(void)
2017 Sep 25
2
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
A bit late to a party, but: On Mon, Dec 8, 2014 at 12:50 AM, Amos Kong <akong at redhat.com> wrote: > From: Rusty Russell <rusty at rustcorp.com.au> > > There's currently a big lock around everything, and it means that we > can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) > while the rng is reading. This is a real problem when the rng is
2017 Sep 25
2
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
A bit late to a party, but: On Mon, Dec 8, 2014 at 12:50 AM, Amos Kong <akong at redhat.com> wrote: > From: Rusty Russell <rusty at rustcorp.com.au> > > There's currently a big lock around everything, and it means that we > can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) > while the rng is reading. This is a real problem when the rng is
2020 Aug 31
0
[PATCH v3] virtio-rng: return available data with O_NONBLOCK
...90001e02bf7..8eaeceecb41e 100644 >>>> --- a/drivers/char/hw_random/virtio-rng.c >>>> +++ b/drivers/char/hw_random/virtio-rng.c >>>> @@ -65,7 +65,7 @@ static int virtio_read(struct hwrng *rng, void >>>> *buf, size_t size, bool wait) >>>> register_buffer(vi, buf, size); >>>> } >>>> >>>> - if (!wait) >>>> + if (!wait && !completion_done(&vi->have_data)) >>>> return 0; >>>> >>>> ret = wait_for_completion_killable(&vi->have_data); &gt...
2012 May 28
6
[PATCH 0/5] virtio: rng: fixes
Hi Rusty, These are a few fixes for the virtio-rng driver. These were tested using the not-yet-upstream virtio-rng device patch to qemu: http://thread.gmane.org/gmane.comp.emulators.qemu/152668 Please apply. Amit Shah (5): virtio ids: fix comment for virtio-rng virtio: rng: allow tasks to be killed that are waiting for rng input virtio: rng: don't wait on host when module is going
2012 May 28
6
[PATCH 0/5] virtio: rng: fixes
Hi Rusty, These are a few fixes for the virtio-rng driver. These were tested using the not-yet-upstream virtio-rng device patch to qemu: http://thread.gmane.org/gmane.comp.emulators.qemu/152668 Please apply. Amit Shah (5): virtio ids: fix comment for virtio-rng virtio: rng: allow tasks to be killed that are waiting for rng input virtio: rng: don't wait on host when module is going
2009 Sep 21
0
[PATCH 2/6] virtio: make add_buf return capacity remaining
...vq, vblk->sg, out, in, vbr) < 0) { mempool_free(vbr, vblk->pool); return false; } diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -51,7 +51,7 @@ static void register_buffer(void) sg_init_one(&sg, random_data+data_left, RANDOM_DATA_SIZE-data_left); /* There should always be room for one buffer. */ - if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0) + if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) < 0) BUG(); vq->v...
2009 Sep 21
0
[PATCH 2/6] virtio: make add_buf return capacity remaining
...vq, vblk->sg, out, in, vbr) < 0) { mempool_free(vbr, vblk->pool); return false; } diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -51,7 +51,7 @@ static void register_buffer(void) sg_init_one(&sg, random_data+data_left, RANDOM_DATA_SIZE-data_left); /* There should always be room for one buffer. */ - if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0) + if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) < 0) BUG(); vq->v...
2010 Jun 23
4
[RFC] virtio: Support releasing lock during kick
...virtblk_prepare_flush(struct request_queue *q, struct request *req) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 75f1cbd..852d563 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -49,7 +49,7 @@ static void register_buffer(u8 *buf, size_t size) if (virtqueue_add_buf(vq, &sg, 0, 1, buf) < 0) BUG(); - virtqueue_kick(vq); + virtqueue_kick(vq, NULL); } static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c...
2010 Jun 23
4
[RFC] virtio: Support releasing lock during kick
...virtblk_prepare_flush(struct request_queue *q, struct request *req) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 75f1cbd..852d563 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -49,7 +49,7 @@ static void register_buffer(u8 *buf, size_t size) if (virtqueue_add_buf(vq, &sg, 0, 1, buf) < 0) BUG(); - virtqueue_kick(vq); + virtqueue_kick(vq, NULL); } static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c...