]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
pvSCSI: add new device assignment mode
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Feb 2009 11:17:11 +0000 (11:17 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Feb 2009 11:17:11 +0000 (11:17 +0000)
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@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
drivers/xen/scsiback/common.h
drivers/xen/scsiback/scsiback.c
drivers/xen/scsiback/xenbus.c

index 8ba0b584462ce66eb321341674f63c0a6a9ad423..12923fe1878366a1c73b30bbafb6a57ca8da8da3 100644 (file)
@@ -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,
index 664ed3157eb56a1fa26d5385b0176a83be40455f..9d151c1f98f76eaf80022c5a049996e5e3e6ad18 100644 (file)
@@ -232,7 +232,9 @@ static void scsiback_cmd_done(struct request *req, int uptodate)
                        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 vscsibk_info *info)
                }
 
                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 {
index 86be18583e9ed8f0193c60a86f3d03e33a3c55fe..5f8e3459d2058fd20c0ffc28f5f0b7e96525fd97 100644 (file)
@@ -301,6 +301,7 @@ static int scsiback_probe(struct xenbus_device *dev,
                           const struct xenbus_device_id *id)
 {
        int err;
+       unsigned val = 0;
 
        struct backend_info *be = kzalloc(sizeof(struct backend_info),
                                          GFP_KERNEL);
@@ -325,9 +326,18 @@ static int scsiback_probe(struct xenbus_device *dev,
 
        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)
                goto fail;