qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Assigning a new virtio block device (-drive)


From: Leib, David
Subject: [Qemu-devel] Assigning a new virtio block device (-drive)
Date: Thu, 27 Oct 2011 14:47:11 +0200

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: address@hidden  I   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
---------------------------------------------------------------------------------------------------------------------------
 
 
 

reply via email to

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