[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] pvSCSI: add new device assignment mode



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1234869431 0
# Node ID be85b1d7a52b624a66f23e7e221a6017b51e001b
# Parent  3aa9b8a7876b7f2ed7ad9663edb460e4710c22da
pvSCSI: add new device assignment mode

Add a new device assignment mode, which assigns whole HBA
(SCSI host) to guest domain. Current implementation requires SCSI
command emulation on backend driver, and it causes limitations for
some SCSI commands. (Please see
"http://www.xen.org/files/xensummit_tokyo/24_Hitoshi%20Matsumoto_en.pdf";
for detail about why we need the new assignment mode.

SCSI command emulation on backend driver is bypassed when "host" mode
is specified.

Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx>
---
 drivers/xen/scsiback/common.h   |    3 +++
 drivers/xen/scsiback/scsiback.c |   12 ++++++++++--
 drivers/xen/scsiback/xenbus.c   |   10 ++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff -r 3aa9b8a7876b -r be85b1d7a52b drivers/xen/scsiback/common.h
--- a/drivers/xen/scsiback/common.h     Fri Feb 06 12:01:56 2009 +0000
+++ b/drivers/xen/scsiback/common.h     Tue Feb 17 11:17:11 2009 +0000
@@ -86,6 +86,8 @@ struct vscsibk_info {
        unsigned int evtchn;
        unsigned int irq;
 
+       int feature;
+
        struct vscsiif_back_ring  ring;
        struct vm_struct *ring_area;
        grant_handle_t shmem_handle;
@@ -143,6 +145,7 @@ typedef struct {
 
 #define VSCSIIF_TIMEOUT                (900*HZ)
 
+#define VSCSI_TYPE_HOST                1
 
 irqreturn_t scsiback_intr(int, void *, struct pt_regs *);
 int scsiback_init_sring(struct vscsibk_info *info,
diff -r 3aa9b8a7876b -r be85b1d7a52b drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c   Fri Feb 06 12:01:56 2009 +0000
+++ b/drivers/xen/scsiback/scsiback.c   Tue Feb 17 11:17:11 2009 +0000
@@ -232,7 +232,9 @@ static void scsiback_cmd_done(struct req
                        scsiback_print_status(sense_buffer, errors, 
pending_req);
        }
 
-       scsiback_rsp_emulation(pending_req);
+       /* The Host mode is through as for Emulation. */
+       if (pending_req->info->feature != VSCSI_TYPE_HOST)
+               scsiback_rsp_emulation(pending_req);
 
        scsiback_fast_flush_area(pending_req);
        scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req);
@@ -616,7 +618,13 @@ static int scsiback_do_cmd_fn(struct vsc
                }
 
                if (pending_req->act == VSCSIIF_ACT_SCSI_CDB) {
-                       scsiback_req_emulation_or_cmdexec(pending_req);
+
+                       /* The Host mode is through as for Emulation. */
+                       if (info->feature == VSCSI_TYPE_HOST)
+                               scsiback_cmd_exec(pending_req);
+                       else
+                               scsiback_req_emulation_or_cmdexec(pending_req);
+
                } else if (pending_req->act == VSCSIIF_ACT_SCSI_RESET) {
                        scsiback_device_reset_exec(pending_req);
                } else {
diff -r 3aa9b8a7876b -r be85b1d7a52b drivers/xen/scsiback/xenbus.c
--- a/drivers/xen/scsiback/xenbus.c     Fri Feb 06 12:01:56 2009 +0000
+++ b/drivers/xen/scsiback/xenbus.c     Tue Feb 17 11:17:11 2009 +0000
@@ -301,6 +301,7 @@ static int scsiback_probe(struct xenbus_
                           const struct xenbus_device_id *id)
 {
        int err;
+       unsigned val = 0;
 
        struct backend_info *be = kzalloc(sizeof(struct backend_info),
                                          GFP_KERNEL);
@@ -325,8 +326,17 @@ static int scsiback_probe(struct xenbus_
 
        be->info->dev = dev;
        be->info->irq = 0;
+       be->info->feature = 0;  /*default not HOSTMODE.*/
 
        scsiback_init_translation_table(be->info);
+
+       err = xenbus_scanf(XBT_NIL, dev->nodename,
+                               "feature-host", "%d", &val);
+       if (XENBUS_EXIST_ERR(err))
+               val = 0;
+
+       if (val)
+               be->info->feature = VSCSI_TYPE_HOST;
 
        err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.