All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Konrad <fred.konrad@greensocs.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: aliguori@us.ibm.com, aik@ozlabs.ru, mark.burton@greensocs.com,
	qemu-devel@nongnu.org, qemu-stable@nongnu.org,
	pbonzini@redhat.com, david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCH] virtio-scsi: forward scsibus for virtio-scsi-pci.
Date: Tue, 11 Jun 2013 08:43:51 +0200	[thread overview]
Message-ID: <51B6C727.9050604@greensocs.com> (raw)
In-Reply-To: <20130610170040.GA31383@redhat.com>

On 10/06/2013 19:00, Michael S. Tsirkin wrote:
> On Mon, Jun 10, 2013 at 11:53:04AM +0200, fred.konrad@greensocs.com wrote:
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>
>> This fix a bug with scsi hotplug on virtio-scsi-pci:
>>
>> As virtio-scsi-pci doesn't have any scsi bus, we need to forward scsi-hot-add
>> to the virtio-scsi-device plugged on the virtio-bus.
>>
>> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>> ---
>>   hw/pci/pci-hotplug.c | 19 +++++++++++++++++--
>>   1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c
>> index 12287d1..c708752 100644
>> --- a/hw/pci/pci-hotplug.c
>> +++ b/hw/pci/pci-hotplug.c
>> @@ -30,6 +30,8 @@
>>   #include "monitor/monitor.h"
>>   #include "hw/scsi/scsi.h"
>>   #include "hw/virtio/virtio-blk.h"
>> +#include "hw/virtio/virtio-scsi.h"
>> +#include "hw/virtio/virtio-pci.h"
>>   #include "qemu/config-file.h"
>>   #include "sysemu/blockdev.h"
>>   #include "qapi/error.h"
>> @@ -79,13 +81,26 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
>>   {
>>       SCSIBus *scsibus;
>>       SCSIDevice *scsidev;
>> +    VirtIOPCIProxy *virtio_proxy;
>>   
>>       scsibus = (SCSIBus *)
>>           object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)),
>>                               TYPE_SCSI_BUS);
>>       if (!scsibus) {
>> -	error_report("Device is not a SCSI adapter");
>> -	return -1;
>> +        /*
>> +         * Check if the adapter is a virtio-scsi-pci, and forward scsi_hot_add
>> +         * to the virtio-scsi-device.
>> +         */
>> +        if (!object_dynamic_cast(OBJECT(adapter), TYPE_VIRTIO_SCSI_PCI)) {
>> +            error_report("Device is not a SCSI adapter");
>> +            return -1;
>> +        }
>> +        virtio_proxy = VIRTIO_PCI(adapter);
>> +        adapter = DEVICE(virtio_proxy->bus.vdev);
>> +        scsibus = (SCSIBus *)
>> +                  object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)),
>> +                            TYPE_SCSI_BUS);
>> +        assert(scsibus);
>>       }
>>   
>>       /*
> By the way I really wonder. pci-hotplug.c was supposed to
> be legacy interface.
> Is this the only way to add scsi disks?
> And are other ways broken, too?

Here you can add scsi disks to a given device.
I think the other ways add scsi disks to a given bus?

Do you see any other?

Thanks,
Fred
>
>> -- 
>> 1.8.1.4

  reply	other threads:[~2013-06-11  6:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10  9:53 [Qemu-devel] [PATCH] virtio-scsi: forward scsibus for virtio-scsi-pci fred.konrad
2013-06-10 11:58 ` Andreas Färber
2013-06-10 12:06   ` Frederic Konrad
2013-06-10 17:00 ` Michael S. Tsirkin
2013-06-11  6:43   ` Frederic Konrad [this message]
2013-06-11  7:21     ` Michael S. Tsirkin
2013-06-11  7:32       ` Frederic Konrad
2013-06-11  7:49         ` 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=51B6C727.9050604@greensocs.com \
    --to=fred.konrad@greensocs.com \
    --cc=aik@ozlabs.ru \
    --cc=aliguori@us.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mark.burton@greensocs.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.