All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Hannes Reinecke <hare@suse.de>,
	Christoph Hellwig <hch@lst.de>
Subject: [Qemu-devel] Commit 622b520f changed -drive if=scsi, index=N, intentional?
Date: Thu, 27 Jan 2011 13:10:50 +0100	[thread overview]
Message-ID: <m3oc72eed1.fsf@blackfin.pond.sub.org> (raw)

Consider -drive if=scsi,index=12,...

Before the commit, index=12 meant bus=1,unit=5.  Example:

    $ qemu-system-x86_64 -nodefaults -vnc :0 -S -monitor stdio -drive if=scsi,index=12,media=cdrom
    QEMU 0.13.50 monitor - type 'help' for more information
    (qemu) info block
    scsi1-cd5: type=cdrom removable=1 locked=0 [not inserted]
    (qemu) info qtree
    [...]
        bus: pci.0
          type PCI
          dev: lsi53c895a, id ""
            bus-prop: addr = 03.0
            bus-prop: romfile = <null>
            bus-prop: rombar = 1
            bus-prop: multifunction = off
            class SCSI controller, addr 00:03.0, pci id 1000:0012 (sub 1af4:1000)
            bar 0: i/o at 0xffffffffffffffff [0xfe]
            bar 1: mem at 0xffffffffffffffff [0x3fe]
            bar 2: mem at 0xffffffffffffffff [0x1ffe]
            bus: scsi.0
              type SCSI
              dev: scsi-disk, id ""
                dev-prop: drive = scsi1-cd5
                dev-prop: logical_block_size = 512
                dev-prop: physical_block_size = 512
                dev-prop: min_io_size = 0
                dev-prop: opt_io_size = 0
                dev-prop: ver = "0.13.50"
                dev-prop: serial = "0"
                bus-prop: scsi-id = 5
          dev: lsi53c895a, id ""
            bus-prop: addr = 02.0
            bus-prop: romfile = <null>
            bus-prop: rombar = 1
            bus-prop: multifunction = off
            class SCSI controller, addr 00:02.0, pci id 1000:0012 (sub 1af4:1000)
            bar 0: i/o at 0xffffffffffffffff [0xfe]
            bar 1: mem at 0xffffffffffffffff [0x3fe]
            bar 2: mem at 0xffffffffffffffff [0x1ffe]
            bus: scsi.0
              type SCSI
    [...]

    Two scsi-buses, and scsi1-cd5 with scsi-id 5 is on the second one,
    i.e. bus=1, unit=5.

After the commit, it means bus=0,unit=12.  The drive is created, but not
the guest device.  That's because lsi53c895a supports only 7 units
(LSI_MAX_DEVS), and scsi_bus_legacy_handle_cmdline() ignores drives with
unit numbers exceeding that limit.  Example:

    $ ~/work/qemu/bld-x86/x86_64-softmmu/qemu-system-x86_64 -nodefaults -usb -m 384 -vnc :0 -enable-kvm -S -readconfig ~/work/qemu/test.cfg -drive if=scsi,index=12,media=cdrom
    QEMU 0.13.50 monitor - type 'help' for more information
    (qemu) info block
    hda: type=hd removable=0 file=/home/armbru/work/images/test.img ro=0 drv=raw encrypted=0
    scsi0-cd12: type=cdrom removable=1 locked=0 [not inserted]
    (qemu) info qtree
    [...]
        bus: pci.0
          type PCI
    [...]
          dev: lsi53c895a, id ""
            bus-prop: addr = 02.0
            bus-prop: romfile = <null>
            bus-prop: rombar = 1
            bus-prop: multifunction = off
            bus-prop: command_serr_enable = on
            class SCSI controller, addr 00:02.0, pci id 1000:0012 (sub 1af4:1000)
            bar 0: i/o at 0xffffffffffffffff [0xfe]
            bar 1: mem at 0xffffffffffffffff [0x3fe]
            bar 2: mem at 0xffffffffffffffff [0x1ffe]
            bus: scsi.0
              type SCSI
    [...]

    One scsi-bus, and scsi1-cd5 nowhere to be found.

I'd call this a regression.

What now?



commit 622b520fb4ca50b5028485f1d225317ece0a42b9
Author: Hannes Reinecke <hare@suse.de>
Date:   Wed Nov 24 12:15:56 2010 +0100

    scsi: Increase the number of possible devices
    
    The SCSI parallel interface has a limit of 8 devices, but
    not the SCSI stack in general. So we should be removing the
    hard-coded limit and use MAX_SCSI_DEVS instead.
    And we only need to scan those devices which are allocated
    by the bus.
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>
    Acked-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>

diff --git a/blockdev.h b/blockdev.h
index 2a0559e..4cb8ca9 100644
--- a/blockdev.h
+++ b/blockdev.h
@@ -32,7 +32,7 @@ struct DriveInfo {
 };
 
 #define MAX_IDE_DEVS	2
-#define MAX_SCSI_DEVS	7
+#define MAX_SCSI_DEVS	255
 
 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
 int drive_get_max_bus(BlockInterfaceType type);
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 5a3fd4b..74a08b7 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -108,7 +108,7 @@ int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
     int res = 0, unit;
 
     loc_push_none(&loc);
-    for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
+    for (unit = 0; unit < bus->ndev; unit++) {
         dinfo = drive_get(IF_SCSI, bus->busnr, unit);
         if (dinfo == NULL) {
             continue;
diff --git a/hw/scsi.h b/hw/scsi.h
index cb06d6d..9c798ae 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -3,6 +3,7 @@
 
 #include "qdev.h"
 #include "block.h"
+#include "blockdev.h"
 #include "block_int.h"
 
 #define SCSI_CMD_BUF_SIZE     16
@@ -86,7 +87,7 @@ struct SCSIBus {
     int tcq, ndev;
     scsi_completionfn complete;
 
-    SCSIDevice *devs[8];
+    SCSIDevice *devs[MAX_SCSI_DEVS];
 };
 
 void scsi_bus_new(SCSIBus *bus, DeviceState *host, int tcq, int ndev,

             reply	other threads:[~2011-01-27 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 12:10 Markus Armbruster [this message]
2011-01-27 12:21 ` [Qemu-devel] Re: Commit 622b520f changed -drive if=scsi, index=N, intentional? Kevin Wolf
2011-01-27 15:11   ` Markus Armbruster
2011-01-27 19:26   ` Gerd Hoffmann
2011-01-28  7:27     ` Hannes Reinecke
2011-01-27 12:35 ` [Qemu-devel] " Daniel P. Berrange
2011-01-27 12:47 ` [Qemu-devel] " Paolo Bonzini

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=m3oc72eed1.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@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.