qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Intended purpose of virtio-rng's QOM link "rng"?
@ 2020-07-20 15:07 Markus Armbruster
  2020-07-20 15:56 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Armbruster @ 2020-07-20 15:07 UTC (permalink / raw)
  To: Michael S. Tsirkin, Cornelia Huck, Halil Pasic, Christian Borntraeger
  Cc: qemu-devel

What is the intended purpose of object_property_set_link() in

    static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
    {
        VirtIORngPCI *vrng = VIRTIO_RNG_PCI(vpci_dev);
        DeviceState *vdev = DEVICE(&vrng->vdev);

        if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
            return;
        }

        object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
                                 NULL);
    }

?

I'm asking because the function *always* fails.  I believe it's been
failing for years.

Similar code in the CCW buddy.  Also virtio-crypto-pci and
virtio-crypto-ccw link "cryptodev".

I tried moving it before qdev_realize(), where it doesn't fail.  But
then *I* fail, namely at finding any effect in QOM.

If it's really useless, I'll send a patch to drop it.

If it has a use, tell me more, so I can test my patch to move it.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Intended purpose of virtio-rng's QOM link "rng"?
  2020-07-20 15:07 Intended purpose of virtio-rng's QOM link "rng"? Markus Armbruster
@ 2020-07-20 15:56 ` Michael S. Tsirkin
  2020-07-21  7:05   ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-07-20 15:56 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Halil Pasic, Christian Borntraeger, Cornelia Huck, qemu-devel

On Mon, Jul 20, 2020 at 05:07:08PM +0200, Markus Armbruster wrote:
> What is the intended purpose of object_property_set_link() in
> 
>     static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
>     {
>         VirtIORngPCI *vrng = VIRTIO_RNG_PCI(vpci_dev);
>         DeviceState *vdev = DEVICE(&vrng->vdev);
> 
>         if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
>             return;
>         }
> 
>         object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
>                                  NULL);
>     }
> 
> ?
> 
> I'm asking because the function *always* fails.  I believe it's been
> failing for years.
> 
> Similar code in the CCW buddy.  Also virtio-crypto-pci and
> virtio-crypto-ccw link "cryptodev".
> 
> I tried moving it before qdev_realize(), where it doesn't fail.  But
> then *I* fail, namely at finding any effect in QOM.

I suspect that's because there's already a link with that name
created by virtio core. Is that right?

> If it's really useless, I'll send a patch to drop it.
> 
> If it has a use, tell me more, so I can test my patch to move it.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Intended purpose of virtio-rng's QOM link "rng"?
  2020-07-20 15:56 ` Michael S. Tsirkin
@ 2020-07-21  7:05   ` Markus Armbruster
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2020-07-21  7:05 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Halil Pasic, Christian Borntraeger, Cornelia Huck, qemu-devel

"Michael S. Tsirkin" <mst@redhat.com> writes:

> On Mon, Jul 20, 2020 at 05:07:08PM +0200, Markus Armbruster wrote:
>> What is the intended purpose of object_property_set_link() in
>> 
>>     static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
>>     {
>>         VirtIORngPCI *vrng = VIRTIO_RNG_PCI(vpci_dev);
>>         DeviceState *vdev = DEVICE(&vrng->vdev);
>> 
>>         if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) {
>>             return;
>>         }
>> 
>>         object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rng),
>>                                  NULL);
>>     }
>> 
>> ?
>> 
>> I'm asking because the function *always* fails.  I believe it's been
>> failing for years.
>> 
>> Similar code in the CCW buddy.  Also virtio-crypto-pci and
>> virtio-crypto-ccw link "cryptodev".
>> 
>> I tried moving it before qdev_realize(), where it doesn't fail.  But
>> then *I* fail, namely at finding any effect in QOM.
>
> I suspect that's because there's already a link with that name
> created by virtio core. Is that right?

Looks like it, in virtio_rng_device_realize():

    if (vrng->conf.rng == NULL) {
        ... make up @default_backend ...
        object_property_set_link(OBJECT(dev), "rng", default_backend,
                                 &error_abort);
    }

The object_property_set_link actually sets vrng->vdev.conf.rng (but it
takes quite some digging to see that; MICAHI[*] at work).

For virtio-crypto, the link is vcrypto->vdev.conf.cryptodev.
virtio_crypto_pci_realize() first checks its already set:

    if (vcrypto->vdev.conf.cryptodev == NULL) {
        error_setg(errp, "'cryptodev' parameter expects a valid object");
        return;
    }

>> If it's really useless, I'll send a patch to drop it.

All four are useless; will send patches.

>> If it has a use, tell me more, so I can test my patch to move it.

Thanks!


[*] Make It Complicated And Hide It.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-21  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 15:07 Intended purpose of virtio-rng's QOM link "rng"? Markus Armbruster
2020-07-20 15:56 ` Michael S. Tsirkin
2020-07-21  7:05   ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).