[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 00/13] support hierarchical LUNs
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [RFC PATCH v2 00/13] support hierarchical LUNs |
Date: |
Mon, 6 Jun 2011 18:04:09 +0200 |
This is the second part of my SCSI work. The first is still pending
and this one is incomplete, but I still would like to get opinions
early enough because this design directly affects the UI.
This series is half of the work that is necessary to support multiple
LUNs behind a target. The idea is to have two devices, "scsi-path"
and "scsi-target", each of which provides both a SCSIDevice and a
SCSIBus.
I plan to do this work using VSCSI and then cut-an^Wapply it later to
virtio-scsi. This way we can be reasonably sure that the approach will
be usable in the Linux virtio-scsi drivers too.
By default, a SCSI device will be added at the highest supported level,
for backwards compatibility. So if you have two disks they will be
connected like this:
- for an HBA like VSCSI or the upcoming virtio-scsi, which supports
multiple paths, the disks will be at path 0/1, target 0, LUN 0
- for an HBA like LSI which only supports one path, the disks will
be at target 0/1, LUN 0.
However, explicit creation of scsi-path and scsi-target devices allows
complete flexibility, for example for VSCSI:
- a scsi-path (id=1) can have a scsi-target, and the target can have
two scsi-disks. Then the disks will be at path 1, target 0, LUN 0/1.
If LUN 0 is not provided, the target will provide a dummy LUN for the
purpose of enumerating the others.
- a scsi-path (id=1) can have two scsi-targets each with two scsi-disk.
Then the four disks will be at path 1, target 0/1, LUN 0/1
- two scsi-path (id=0/1) each with two scsi-targets each with two scsi-disk.
Then the eight disks will be at path 0/1, target 0/1, LUN 0/1
- non-homogeneous scenarios are of course possible, for example two disks
at path 0, target 0, LUN 0/1 and four more at path 1, target 0/1,
LUN 0/1.
For an HBA like lsi, which only supports one level, you can add to your HBA:
- a scsi-target (id=0) which has two scsi-disks. Then the disks
will be at path 0, target 0, LUN 0/1
- two scsi-targets (id=0/1) which have two scsi-disks each. Then the disks
will be at path 0, targets 0/1, LUN 0/1
- one scsi-target (id=0) which has two scsi-disks and one scsi-disk
(id=1). Then two disks will be at path 0, target 0, LUN 0/1,
the third will be at path 0, target 1, LUN 0.
and so on. (Note that the LSI device model does not support LUNs;
the Linux driver doesn't boot if you use them. I tested this scenario
with vmw_pvscsi).
Patch 1 is a cleanup motivated by the introduction of more SCSI devices.
Patch 2 is useful on its own, because it fixes a mismatch in VSCSI's
handling of OpenFirmware and Linux LUNs. It adds the main parsing code,
and I'll probably resubmit it soon.
Patches 3 to 6 adds the infrastructure that will be used by the simple
case where the HBA does not support scsi-path.
Patch 7 adds the infrastructure that will be used in the full case,
and already kind-of attaches VSCSI to it.
Patches 8 and 9 introduce the pseudo-devices above.
Patches 10 to 13 ensure that the qdev representation of devices always
covers all levels. This ensures that REPORT LUNS can be handled by
common code.
Patch 11 is the only one that strays outside hw/scsi-*. It adds
the qdev infrastructure to create implicit buses and devices.
These patches are fully functional except for hot-plug/hot-unplug
and targets lacking a LUN 0. Hot-plug/hot-unplug requires support
for unit attention conditions and will come later.
Paolo Bonzini (13):
scsi: cleanup reset and destroy callbacks
scsi: support parsing of SAM logical unit numbers
scsi: add initiator field to SCSIRequest
scsi: let a SCSIDevice have children devices
scsi: let the bus pick a LUN for the child device
scsi-generic: fix passthrough of devices with LUN != 0
scsi: add walking of hierarchical LUNs
scsi: introduce the scsi-path device
scsi: introduce the scsi-target device
scsi: include bus and device levels
qdev: introduce automatic creation of buses
scsi: create scsi-path and scsi-target devices automatically
scsi: delete handling of REPORT LUNS and unknown LUNs outside
scsi-target
Makefile.objs | 2 +-
hw/esp.c | 10 +-
hw/lsi53c895a.c | 12 +-
hw/qdev.c | 13 ++
hw/qdev.h | 3 +
hw/scsi-bus.c | 253 ++++++++++++++++++++++++++++++++++-
hw/scsi-defs.h | 24 ++++
hw/scsi-disk.c | 45 ++-----
hw/scsi-generic.c | 26 ++---
hw/scsi-luns.c | 384 +++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/scsi.h | 55 +++++++-
hw/spapr_vscsi.c | 30 ++---
hw/usb-msd.c | 8 +-
13 files changed, 765 insertions(+), 100 deletions(-)
create mode 100644 hw/scsi-luns.c
--
1.7.4.4
- [Qemu-devel] [RFC PATCH v2 00/13] support hierarchical LUNs,
Paolo Bonzini <=
- [Qemu-devel] [RFC PATCH v2 02/13] scsi: support parsing of SAM logical unit numbers, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 01/13] scsi: cleanup reset and destroy callbacks, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 03/13] scsi: add initiator field to SCSIRequest, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 04/13] scsi: let a SCSIDevice have children devices, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 05/13] scsi: let the bus pick a LUN for the child device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 06/13] scsi-generic: fix passthrough of devices with LUN != 0, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 07/13] scsi: add walking of hierarchical LUNs, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 08/13] scsi: introduce the scsi-path device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 09/13] scsi: introduce the scsi-target device, Paolo Bonzini, 2011/06/06