ia64/linux-2.6.18-xen.hg

changeset 794:be85b1d7a52b

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@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 17 11:17:11 2009 +0000 (2009-02-17)
parents 3aa9b8a7876b
children 2ee6febdd4f9
files drivers/xen/scsiback/common.h drivers/xen/scsiback/scsiback.c drivers/xen/scsiback/xenbus.c
line diff
     1.1 --- a/drivers/xen/scsiback/common.h	Fri Feb 06 12:01:56 2009 +0000
     1.2 +++ b/drivers/xen/scsiback/common.h	Tue Feb 17 11:17:11 2009 +0000
     1.3 @@ -86,6 +86,8 @@ struct vscsibk_info {
     1.4  	unsigned int evtchn;
     1.5  	unsigned int irq;
     1.6  
     1.7 +	int feature;
     1.8 +
     1.9  	struct vscsiif_back_ring  ring;
    1.10  	struct vm_struct *ring_area;
    1.11  	grant_handle_t shmem_handle;
    1.12 @@ -143,6 +145,7 @@ typedef struct {
    1.13  
    1.14  #define VSCSIIF_TIMEOUT		(900*HZ)
    1.15  
    1.16 +#define VSCSI_TYPE_HOST		1
    1.17  
    1.18  irqreturn_t scsiback_intr(int, void *, struct pt_regs *);
    1.19  int scsiback_init_sring(struct vscsibk_info *info,
     2.1 --- a/drivers/xen/scsiback/scsiback.c	Fri Feb 06 12:01:56 2009 +0000
     2.2 +++ b/drivers/xen/scsiback/scsiback.c	Tue Feb 17 11:17:11 2009 +0000
     2.3 @@ -232,7 +232,9 @@ static void scsiback_cmd_done(struct req
     2.4  			scsiback_print_status(sense_buffer, errors, pending_req);
     2.5  	}
     2.6  
     2.7 -	scsiback_rsp_emulation(pending_req);
     2.8 +	/* The Host mode is through as for Emulation. */
     2.9 +	if (pending_req->info->feature != VSCSI_TYPE_HOST)
    2.10 +		scsiback_rsp_emulation(pending_req);
    2.11  
    2.12  	scsiback_fast_flush_area(pending_req);
    2.13  	scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req);
    2.14 @@ -616,7 +618,13 @@ static int scsiback_do_cmd_fn(struct vsc
    2.15  		}
    2.16  
    2.17  		if (pending_req->act == VSCSIIF_ACT_SCSI_CDB) {
    2.18 -			scsiback_req_emulation_or_cmdexec(pending_req);
    2.19 +
    2.20 +			/* The Host mode is through as for Emulation. */
    2.21 +			if (info->feature == VSCSI_TYPE_HOST)
    2.22 +				scsiback_cmd_exec(pending_req);
    2.23 +			else
    2.24 +				scsiback_req_emulation_or_cmdexec(pending_req);
    2.25 +
    2.26  		} else if (pending_req->act == VSCSIIF_ACT_SCSI_RESET) {
    2.27  			scsiback_device_reset_exec(pending_req);
    2.28  		} else {
     3.1 --- a/drivers/xen/scsiback/xenbus.c	Fri Feb 06 12:01:56 2009 +0000
     3.2 +++ b/drivers/xen/scsiback/xenbus.c	Tue Feb 17 11:17:11 2009 +0000
     3.3 @@ -301,6 +301,7 @@ static int scsiback_probe(struct xenbus_
     3.4  			   const struct xenbus_device_id *id)
     3.5  {
     3.6  	int err;
     3.7 +	unsigned val = 0;
     3.8  
     3.9  	struct backend_info *be = kzalloc(sizeof(struct backend_info),
    3.10  					  GFP_KERNEL);
    3.11 @@ -325,9 +326,18 @@ static int scsiback_probe(struct xenbus_
    3.12  
    3.13  	be->info->dev = dev;
    3.14  	be->info->irq = 0;
    3.15 +	be->info->feature = 0;	/*default not HOSTMODE.*/
    3.16  
    3.17  	scsiback_init_translation_table(be->info);
    3.18  
    3.19 +	err = xenbus_scanf(XBT_NIL, dev->nodename,
    3.20 +				"feature-host", "%d", &val);
    3.21 +	if (XENBUS_EXIST_ERR(err))
    3.22 +		val = 0;
    3.23 +
    3.24 +	if (val)
    3.25 +		be->info->feature = VSCSI_TYPE_HOST;
    3.26 +
    3.27  	err = xenbus_switch_state(dev, XenbusStateInitWait);
    3.28  	if (err)
    3.29  		goto fail;