qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [PATCH] virtio: make bindings typesafe
Date: Mon, 17 Dec 2012 19:21:14 +0100	[thread overview]
Message-ID: <50CF629A.4090005@redhat.com> (raw)
In-Reply-To: <50CF5CA2.7060800@suse.de>

Il 17/12/2012 18:55, Andreas Färber ha scritto:
> Am 17.12.2012 16:45, schrieb Michael S. Tsirkin:
>> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
>> index 3ea4140..63ae888 100644
>> --- a/hw/virtio-pci.c
>> +++ b/hw/virtio-pci.c
>> @@ -98,34 +98,34 @@ bool virtio_is_big_endian(void);
>>  
>>  /* virtio device */
>>  
>> -static void virtio_pci_notify(void *opaque, uint16_t vector)
>> +static void virtio_pci_notify(DeviceState *d, uint16_t vector)
>>  {
>> -    VirtIOPCIProxy *proxy = opaque;
>> +    VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> 
> Nack. This is going the wrong direction QOM-wise and you among all
> others know that from PCI host bridges!

Well, that's just a difference of VIRTIO_PCI_PROXY(d) vs. container_of.

But the patch is still an improvement.  In fact it should a logical
first step even in Peter's refactoring (where the devicestate is
replaced by d->parent_bus or d->parent_bus->parent).

Paolo

> A core issue being addressed here is that virtio devices are modelled
> neither in the regular qdev way nor the QOM way. They don't inherit
> correctly and use their own set of common-init functions - one side
> effect of Fred's series was to make them first-class QOM citizens. QOM
> like qdev doesn't support multi-inheritence, so the discussed approach
> Fred is trying to implement is to have both a VirtioDevice as base class
> for Virtio{Block,...}Device and PCIDevice/SysBusDevice/... as base class
> for a virtio bridge device with a virtio-bus, on which only virtio is
> spoken and pure VirtioDevices can sit (which as you say have device IDs
> but not all PCI properties).
> What remained under discussion AFAIU was how to expose this modelling
> construct to the user - Peter aiming to expose this to the user and me
> proposing to hide this (for PCI) as an internal implementation detail.
> 
> Whether DeviceState or a new VirtioDevice or something else is being
> used in the API is a different issue that I don't really mind.
> 
> Andreas
> 

  reply	other threads:[~2012-12-17 18:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 15:45 [Qemu-devel] [PATCH] virtio: make bindings typesafe Michael S. Tsirkin
2012-12-17 17:55 ` Andreas Färber
2012-12-17 18:21   ` Paolo Bonzini [this message]
2012-12-17 18:25     ` Andreas Färber
2012-12-17 20:48       ` Michael S. Tsirkin
2012-12-17 21:13         ` Andreas Färber
2012-12-17 21:18           ` Michael S. Tsirkin
2012-12-17 22:08             ` Andreas Färber
2012-12-17 22:58               ` Michael S. Tsirkin
2012-12-18  0:13                 ` Andreas Färber
2012-12-18  0:30                   ` Michael S. Tsirkin
2012-12-18  0:48                     ` Andreas Färber
2012-12-18  8:38                       ` Michael S. Tsirkin
2012-12-17 20:50   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50CF629A.4090005@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=fred.konrad@greensocs.com \
    --cc=jan.kiszka@siemens.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).