From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45715 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiRFp-0001DQ-OK for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:47:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiRFk-0003lm-7V for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:47:09 -0500 Received: from mail-fx0-f45.google.com ([209.85.161.45]:60316) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiRFj-0003lD-RN for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:47:08 -0500 Received: by fxm12 with SMTP id 12so2173007fxm.4 for ; Thu, 27 Jan 2011 04:47:06 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4D416944.4080309@redhat.com> Date: Thu, 27 Jan 2011 13:47:00 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: Commit 622b520f changed -drive if=scsi, index=N, intentional? List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Kevin Wolf , Christoph Hellwig , qemu-devel@nongnu.org, Hannes Reinecke On 01/27/2011 01:10 PM, Markus Armbruster wrote: > 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 = > 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 = > 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. The culprit is type = IF_SCSI; max_devs = MAX_SCSI_DEVS; pstrcpy(devname, sizeof(devname), "scsi"); ... } else if (!strcmp(buf, "scsi")) { type = IF_SCSI; max_devs = MAX_SCSI_DEVS; Here is a patch, untested but trivial. -------------- --8< ---------------- >>From f64236fa1df4cfecaa2e5b91ce5eeb47ce97e97c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 27 Jan 2011 13:45:16 +0100 Subject: [PATCH] change behavior of index=N to be the same as 0.13 and earlier Even though we support theoretically more than 7 devices per target, the controllers we have do not and they ignore LUNs above 6. Signed-off-by: Paolo Bonzini --- blockdev.c | 4 ++-- blockdev.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index f7f591f..c5078f8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -163,7 +163,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error) if (default_to_scsi) { type = IF_SCSI; - max_devs = MAX_SCSI_DEVS; + max_devs = DEFAULT_SCSI_DEVS_PER_BUS; pstrcpy(devname, sizeof(devname), "scsi"); } else { type = IF_IDE; @@ -194,7 +194,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error) max_devs = MAX_IDE_DEVS; } else if (!strcmp(buf, "scsi")) { type = IF_SCSI; - max_devs = MAX_SCSI_DEVS; + max_devs = DEFAULT_SCSI_DEVS_PER_BUS; } else if (!strcmp(buf, "floppy")) { type = IF_FLOPPY; max_devs = 0; diff --git a/blockdev.h b/blockdev.h index 4536b5c..1cfc013 100644 --- a/blockdev.h +++ b/blockdev.h @@ -31,8 +31,9 @@ struct DriveInfo { QTAILQ_ENTRY(DriveInfo) next; }; -#define MAX_IDE_DEVS 2 -#define MAX_SCSI_DEVS 255 +#define MAX_IDE_DEVS 2 +#define MAX_SCSI_DEVS 255 +#define DEFAULT_SCSI_DEVS_PER_BUS 7 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); int drive_get_max_bus(BlockInterfaceType type); -- 1.7.3.4 Paolo