qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Assigning a new virtio block device (-drive)
@ 2011-10-27 12:47 Leib, David
  2011-10-27 15:14 ` Paolo Bonzini
  2011-10-28  7:09 ` Markus Armbruster
  0 siblings, 2 replies; 3+ messages in thread
From: Leib, David @ 2011-10-27 12:47 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 4194 bytes --]

Hi,
I am trying to assign a new virtio block device in addition to a normal virtio block device who are accessing exactly the same cdrom drive ("/dev/sr0") because I additionaly want to access the block device in my way by manually calling the virtqueue_pop and virtqueue_push and not the normal way they are called.
At the kvm startup I am assigning this additional qemu rblock device in the vm_config_groups by adding a new QemuOptsList:

static QemuOptsList qemu_ablock_opts = {
    .name = "ablock",
    .head = QTAILQ_HEAD_INITIALIZER(qemu_ablock_opts.head),
    .desc = {
                        ..... normal options like the original virtio block device .....
        { /* end of list */ }
    },
};

and insert the same data like the normal virtio block device ("file=/dev/sr0" and "if=virtio") in qemu_config.c.
After that I am calling the normal drive_init_func  ("vl.c") with this command :

qemu_opts_foreach(qemu_find_opts("ablock"), drive_init_func, &machine->use_scsi, 1);

I also added PCIDeviceInfo to the virtio_info array who looks like this:
    {
                .qdev.name = "additional_blk_pci",
                .qdev.alias = "additional-blk",
                .qdev.size = sizeof(VirtIOPCIProxy),
                .init      = virtio_blk_init_pci_additional,
                .exit      = virtio_blk_exit_pci,
                .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET,
                .device_id = PCI_DEVICE_ID_VIRTIO_BLOCK,
                .revision  = VIRTIO_PCI_ABI_VERSION,
                .class_id  = PCI_CLASS_STORAGE_SCSI,
                .qdev.props = (Property[]) {
                        DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
                        DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, block),
                        DEFINE_PROP_STRING("serial", VirtIOPCIProxy, block_serial),
                        DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                                                        VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
                        DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
                        DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features),
                        DEFINE_PROP_END_OF_LIST(),
                },
                .qdev.reset = virtio_pci_reset,
        },
It is completely the same like the normal "virtio-blk-pci" except the .init function that I replaced with my own init-function.
My problem now is that this init-function is never called when I am starting up the kvm. It only calling the the init-function of "virtio-blk-pci" two times and my PCIDeviceInfo init-function is completely ignored.
The initialisation of all virtio_info's in "virtio-pci.c" works fine but my init-function is never used.
I tried to initialise only my "additional-virtio-blk-pci" device but is still calling the init-function from "virtio-blk-pci".
I hope somebody can give me idea where the problem is.
Many thanks,


David Leib
SAP Research Belfast
SAP (UK) Limited   I   The Concourse   I   Queen's Road   I   Queen's Island   I   Belfast BT3 9DT

mailto: david.leib@sap.com<mailto:mary.clarke@sap.com>  I   www.sap.com/research<http://www.sap.com/research>

--------------------------------------------------------------------------------------------------------------------------
This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the addressee. If you are not the addressee please contact us immediately and also delete the communication from your computer. Steps have been taken to ensure this e-mail is free from computer viruses but the recipient is responsible for ensuring that it is actually virus free before opening it or any attachments. Any views and/or opinions expressed in this e-mail are of the author only and do not represent the views of SAP.

SAP (UK) Limited, Registered in England No. 2152073. Registered Office: Clockhouse Place, Bedfont Road, Feltham, Middlesex, TW14 8HD
---------------------------------------------------------------------------------------------------------------------------




[-- Attachment #2: Type: text/html, Size: 8674 bytes --]

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

end of thread, other threads:[~2011-10-28  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 12:47 [Qemu-devel] Assigning a new virtio block device (-drive) Leib, David
2011-10-27 15:14 ` Paolo Bonzini
2011-10-28  7:09 ` 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).