qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] virtio-rng


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] virtio-rng
Date: Mon, 16 Nov 2009 14:10:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]