From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NA1Lo-0002qI-VS for qemu-devel@nongnu.org; Mon, 16 Nov 2009 08:10:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NA1Lk-0002mA-Tc for qemu-devel@nongnu.org; Mon, 16 Nov 2009 08:10:36 -0500 Received: from [199.232.76.173] (port=47210 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NA1Lk-0002lz-Pt for qemu-devel@nongnu.org; Mon, 16 Nov 2009 08:10:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23769) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NA1Lk-0008No-88 for qemu-devel@nongnu.org; Mon, 16 Nov 2009 08:10:32 -0500 Message-ID: <4B014F2D.3040205@redhat.com> Date: Mon, 16 Nov 2009 14:10:05 +0100 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] virtio-rng References: <4AFB2D4D.8050208@collabora.co.uk> <4B011F38.9070500@redhat.com> <4B014584.6000001@collabora.co.uk> In-Reply-To: <4B014584.6000001@collabora.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ian Molton Cc: qemu-devel@nongnu.org On 11/16/09 13:28, Ian Molton wrote: > I've done something similar (below) > > My commandline looks like: > > - -virtiorng dev=/dev/foo,rate=1234 > > I added some properties to my driver which are obviously then filled in > from the options code, and I do my init like this: There is no need for a new -virtiorng switch. qdev allows to set any property when creating devices via -device on the command line. > VirtIODevice *virtio_rng_init(DeviceState *dev, RNGConf *rngdev) > { > VirtIORng *s; > s = (VirtIORng *)virtio_common_init("virtio-rng", > VIRTIO_ID_RNG, > 0, sizeof(VirtIORng)); > > if (!s) > return NULL; > > s->vdev.get_features = virtio_rng_get_features; > > s->vq = virtio_add_queue(&s->vdev, 128, virtio_rng_handle); > s->chr = qemu_chr_open("vrngdev", rngdev->device, NULL); > > ... > > return&s->vdev; > } > > Is this 'not the right way' ? I think the commandline looks much simpler > this way. The point is to separate host and guest state. -chardev ist host state, the device is guest state, and they are linked using the chardev name. > OTOH, I can see that this might help with my next problem, which is that > I want to write EGD support for virtio-rng, so I'm guessing my > commandline would (in your scheme) need to be something like: > > > -tcpsocketthing $addr.of.egd.server,id=some-name-here, > more-egd-client-options > -device virtio-rng,tcpsocketthing=some-name-here,rate=$limit Maybe ... -chardev socket,id=egd,host=egd.domain.tld,port=whatever -device virtio-rng,chardev=egd ... ? > This doesnt, however, get around my problem that the -device option > doesnt know how to parse OPT_SIZE types, though. (I'd like to be able to > specify 'rate' in B/s or KB/s (or even kbits/sec, more appropriately)) Yes, there is no qdev property type (yet) which can parse those postfixes. Which is no reason to not add one though ;) cheers, Gerd