From: Konrad Frederic <fred.konrad@greensocs.com>
To: Anthony Liguori <aliguori@us.ibm.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: e.voevodin@samsung.com, mark.burton@greensocs.com,
qemu-devel@nongnu.org, stefanha@redhat.com,
cornelia.huck@de.ibm.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus.
Date: Thu, 29 Nov 2012 13:37:42 +0100 [thread overview]
Message-ID: <50B75716.6030308@greensocs.com> (raw)
In-Reply-To: <877gp8pafv.fsf@codemonkey.ws>
On 26/11/2012 17:59, Anthony Liguori wrote:
> Peter Maydell<peter.maydell@linaro.org> writes:
>
>> On 26 November 2012 14:33, Anthony Liguori<aliguori@us.ibm.com> wrote:
>>> VirtioBusInfo is not a great name. This is a proxy class that allows
>>> for a device to implement the virtio bus interface.
>>>
>>> This could be done as an interface but since nothing else uses
>>> interfaces, I'm okay with something like this. But the first argument
>>> ought to be an opaque for all methods.
>> We have at least one user of Interface in the tree IIRC.
>> I'd much rather we did this the right way -- the only reason
>> it's the way Fred has coded it is that there's no obvious
>> body of code in the tree to copy, so we're thrashing around
>> a bit. If you tell us what the correct set of structs/classes/
>> interfaces/etc is then we can implement it :-)
> I really think extending virtio-bus to a virtio-pci-bus and then
> initializing it with a link to the PCI device is the best approach.
>
> It's by far the simpliest approach in terms of coding.
>
> Did I explain it adequately? To recap:
>
> virtio-bus extends bus-state
> - implements everything that VirtIOBindings implements as methods
>
> virtio-pci-bus extends virtio-bus
> - is constructed with a pointer to a PCIDevice
> - implements the methods necessary to be a virtio bus
I still have trouble with that ^^.
virtio-pci-bus extends virtio-bus so I put something like that :
static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
{
BusClass *bc = BUS_CLASS(klass);
VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
/* VirtIOBindings */
k->notify = virtio_pci_notify;
k->save_config = virtio_pci_save_config;
k->load_config = virtio_pci_load_config;
k->save_queue = virtio_pci_save_queue;
k->load_queue = virtio_pci_load_queue;
k->get_features = virtio_pci_get_features;
k->query_guest_notifiers = virtio_pci_query_guest_notifiers;
k->set_host_notifier = virtio_pci_set_host_notifier;
k->set_guest_notifiers = virtio_pci_set_guest_notifiers;
k->vmstate_change = virtio_pci_vmstate_change;
/*
* TODO : Init and exit function.
* void (*init)(void *opaque);
* void (*exit)(void *opaque);
*/
}
static TypeInfo virtio_pci_bus_info = {
.name = TYPE_VIRTIO_PCI_BUS,
.parent = TYPE_VIRTIO_BUS,
.class_init = virtio_pci_bus_class_init,
};
and I have VirtioDevice which extends DeviceState like that :
static void virtio_device_class_init(ObjectClass *klass, void *data)
{
/* Set the default value here. */
DeviceClass *dc = DEVICE_CLASS(klass);
dc->bus_type = TYPE_VIRTIO_BUS;
dc->init = virtio_device_init;
}
static TypeInfo virtio_device_info = {
.name = TYPE_VIRTIO_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VirtioDeviceState),
/* Abstract the virtio-device */
.class_init = virtio_device_class_init,
.abstract = true,
.class_size = sizeof(VirtioDeviceClass),
};
The problem is that the virtio devices can't be connected to the
virtio-pci-bus even if it extends virtio-bus because TYPE_VIRTIO_BUS !=
TYPE_VIRTIO_PCI_BUS.
Did I miss something ?
Thanks,
Fred
> virtio-device extends device-state
> - implements methods used by virtio-bus
>
> Regards,
>
> Anthony Liguori
>
>> -- PMM
next prev parent reply other threads:[~2012-11-29 12:37 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 14:50 [Qemu-devel] [RFC PATCH v2 0/3] Virtio-refactoring fred.konrad
2012-11-22 14:50 ` [Qemu-devel] [RFC PATCH v2 1/3] virtio-bus : Introduce VirtioBus fred.konrad
2012-11-23 12:08 ` Cornelia Huck
2012-11-23 14:12 ` Konrad Frederic
2012-11-23 14:35 ` Cornelia Huck
2012-11-26 13:55 ` Konrad Frederic
2012-11-26 14:03 ` Cornelia Huck
2012-11-23 12:23 ` Stefan Hajnoczi
2012-11-23 14:21 ` Konrad Frederic
2012-11-23 16:13 ` Stefan Hajnoczi
2012-11-24 22:29 ` Andreas Färber
2012-11-26 14:33 ` Anthony Liguori
2012-11-26 14:37 ` Peter Maydell
2012-11-26 16:59 ` Anthony Liguori
2012-11-29 12:37 ` Konrad Frederic [this message]
2012-11-29 13:09 ` Peter Maydell
2012-11-29 13:47 ` Konrad Frederic
2012-11-29 13:53 ` Peter Maydell
2012-11-29 13:55 ` Andreas Färber
2012-11-29 14:28 ` Konrad Frederic
2012-11-29 13:52 ` Anthony Liguori
2012-11-26 14:45 ` Andreas Färber
2012-11-26 16:55 ` Anthony Liguori
2012-11-26 15:33 ` Konrad Frederic
2012-11-26 15:40 ` Stefan Hajnoczi
2012-11-22 14:50 ` [Qemu-devel] [RFC PATCH v2 2/3] virtio-pci : add a virtio-bus interface fred.konrad
2012-11-23 12:11 ` Cornelia Huck
2012-11-23 12:29 ` Stefan Hajnoczi
2012-11-23 12:34 ` Peter Maydell
2012-11-23 14:23 ` Konrad Frederic
2012-11-23 14:26 ` Peter Maydell
2012-11-23 14:33 ` Konrad Frederic
2012-11-26 14:43 ` Anthony Liguori
2012-11-22 14:50 ` [Qemu-devel] [RFC PATCH v2 3/3] virtio-blk : add the virtio-blk device fred.konrad
2012-11-23 12:32 ` Stefan Hajnoczi
2012-11-22 15:08 ` [Qemu-devel] [RFC PATCH v2 0/3] Virtio-refactoring Peter Maydell
2012-11-22 15:15 ` KONRAD Frédéric
2012-11-23 12:38 ` Stefan Hajnoczi
2012-11-23 14:29 ` Konrad Frederic
2012-11-23 16:18 ` Stefan Hajnoczi
2012-11-26 9:00 ` Konrad Frederic
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=50B75716.6030308@greensocs.com \
--to=fred.konrad@greensocs.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=e.voevodin@samsung.com \
--cc=mark.burton@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).