qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "KONRAD Frédéric" <fred.konrad@greensocs.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: aliguori@us.ibm.com, 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 v7 7/8] virtio-pci-blk : Switch to new API.
Date: Thu, 13 Dec 2012 09:24:22 +0100	[thread overview]
Message-ID: <50C990B6.5050806@greensocs.com> (raw)
In-Reply-To: <CAFEAcA8rEg2S84Pz=pZ5FvvRdJbwwp8o-fAxVGne6_eN7LXstQ@mail.gmail.com>

On 12/12/2012 15:25, Peter Maydell wrote:
> On 10 December 2012 16:45,  <fred.konrad@greensocs.com> wrote:
>> -static void virtio_blk_class_init(ObjectClass *klass, void *data)
>> -{
>> -    DeviceClass *dc = DEVICE_CLASS(klass);
>> -    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
>> -
>> -    k->init = virtio_blk_init_pci;
>> -    k->exit = virtio_blk_exit_pci;
>> -    k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
>> -    k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
>> -    k->revision = VIRTIO_PCI_ABI_VERSION;
>> -    k->class_id = PCI_CLASS_STORAGE_SCSI;
>> -    dc->reset = virtio_pci_reset;
>> -    dc->props = virtio_blk_properties;
>> -}
> This hunk removes the setting of the PCI vendor and device IDs
> but I can't see where they are set in the new code.
>
> How will the PCI transport's PCI vendor/device/class IDs be
> set (a) when a virtio-blk backend is created and separately
> plugged into a virtio-pci transport (b) for the legacy
> virtio-pci-blk? [ideally the answer to (b) should be "in the
> same way as for (a)"]
>
> -- PMM

It's done in the virtio_pci_device_plugged(), ( step 4 )
At this time we have the device ID, so we can put the PCI IDs :

+static void virtio_pci_device_plugged(void *opaque)
+{
+    VirtIOPCIProxy *proxy = VIRTIO_PCI(opaque);
+    uint8_t *config;
+    uint32_t size;
+
+    /* Put the PCI IDs */
+    switch (get_virtio_device_id(proxy->bus)) {
+
+    case VIRTIO_ID_BLOCK:
+        pci_config_set_device_id(proxy->pci_dev.config,
+                                 PCI_DEVICE_ID_VIRTIO_BLOCK);
+        pci_config_set_class(proxy->pci_dev.config, PCI_CLASS_STORAGE_SCSI);
+    break;
+    default:
+        error_report("unknown device id\n");
+    break;
+
+    }

I'll move the "case" to the step 7 as it should be.

Fred

  parent reply	other threads:[~2012-12-13  8:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10 16:45 [Qemu-devel] [RFC PATCH v7 0/8] Virtio refactoring fred.konrad
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 1/8] qdev : add a maximum device allowed field for the bus fred.konrad
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 2/8] virtio-bus : Introduce virtio-bus fred.konrad
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 3/8] virtio-pci-bus : Introduce virtio-pci-bus fred.konrad
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 4/8] virtio-pci : Refactor virtio-pci device fred.konrad
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 5/8] virtio-device : Refactor virtio-device fred.konrad
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 6/8] virtio-blk : Add the virtio-blk device fred.konrad
2012-12-11 17:33   ` Peter Maydell
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 7/8] virtio-pci-blk : Switch to new API fred.konrad
2012-12-11 17:50   ` Peter Maydell
2012-12-13  8:57     ` KONRAD Frédéric
2012-12-12 14:25   ` Peter Maydell
2012-12-12 17:53     ` Andreas Färber
2012-12-12 17:56       ` Paolo Bonzini
2012-12-12 17:58       ` Peter Maydell
2012-12-12 18:03         ` Paolo Bonzini
2012-12-12 21:22           ` Michael S. Tsirkin
2012-12-13  9:37             ` Paolo Bonzini
2012-12-13 14:51           ` Anthony Liguori
2012-12-16 16:01             ` Michael S. Tsirkin
2012-12-13  9:24         ` KONRAD Frédéric
2012-12-16 16:41       ` Andreas Färber
2012-12-13  8:24     ` KONRAD Frédéric [this message]
2012-12-13 10:56       ` KONRAD Frédéric
2012-12-10 16:45 ` [Qemu-devel] [RFC PATCH v7 8/8] virtio-blk : QOM modifications fred.konrad
2012-12-11 17:32   ` Peter Maydell
2012-12-11 17:52 ` [Qemu-devel] [RFC PATCH v7 0/8] Virtio refactoring Peter Maydell

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=50C990B6.5050806@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).