From: VMware, Inc <> Date: Thu, 15 Oct 2009 21:04:31 +0000 (-0700) Subject: Pvscsi driver accepts 16 byte CDBs, emulation rejects OUT_OF_BAND_CDB flag X-Git-Tag: 2009.10.15-201664~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b142e36c68b78782972b54bc21ba673344fc73ac;p=thirdparty%2Fopen-vm-tools.git Pvscsi driver accepts 16 byte CDBs, emulation rejects OUT_OF_BAND_CDB flag As pointed out in bug 472258, our linux driver doesn't set host->max_cmd_len, so the guest kernel uses the default of 12. That means 16-byte long commands won't make it through to our emulation at all. Since disklib doesn't support 2TB disks yet, its not that bad, but we would like to support >2TB disks connected as s/g devices for klnext. That requires READ16 and WRITE16. One line driver fix. The other bug here is that we advertise a flag for sending OUT_OF_BAND_CDBs, a method for sending > 16 bytes of CDB. We don't implement it and silently ignore it. Thats bad -- we'd like to at least reject these commands so future revs of the driver could use this flag for something interesting without worrying about silent failures. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/linux/pvscsi/pvscsi.c b/open-vm-tools/modules/linux/pvscsi/pvscsi.c index bbd809736..63e376a57 100644 --- a/open-vm-tools/modules/linux/pvscsi/pvscsi.c +++ b/open-vm-tools/modules/linux/pvscsi/pvscsi.c @@ -619,6 +619,8 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, LOG(3, "cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n", cmd, cmd->cmnd[0], ctx, cmd->result, btstat, sdstat); + printk(KERN_ERR "pvscsi: cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n", + cmd, cmd->cmnd[0], ctx, cmd->result, btstat, sdstat); cmd->scsi_done(cmd); } @@ -722,6 +724,11 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter, e->flags = PVSCSI_FLAG_CMD_DIR_NONE; else e->flags = 0; + { static int i = 0; + if (++i%2) + //e->flags |= PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB; + e->flags |= (1 << 5); + } pvscsi_map_buffers(adapter, ctx, cmd, e); @@ -1269,6 +1276,7 @@ static int __devinit pvscsi_probe(struct pci_dev *pdev, host->max_channel = 0; host->max_id = 16; host->max_lun = 1; + host->max_cmd_len = 16; pci_read_config_byte(pdev, PCI_CLASS_REVISION, &adapter->rev); diff --git a/open-vm-tools/modules/linux/pvscsi/pvscsi_defs.h b/open-vm-tools/modules/linux/pvscsi/pvscsi_defs.h index 92cac2478..8eccb04ea 100644 --- a/open-vm-tools/modules/linux/pvscsi/pvscsi_defs.h +++ b/open-vm-tools/modules/linux/pvscsi/pvscsi_defs.h @@ -449,6 +449,8 @@ PVSCSIRingsState; #define PVSCSI_FLAG_CMD_DIR_TOHOST (1 << 3) #define PVSCSI_FLAG_CMD_DIR_TODEVICE (1 << 4) +#define PVSCSI_FLAG_RESERVED_MASK (~MASK(5)) + typedef #include "vmware_pack_begin.h" struct PVSCSIRingReqDesc { diff --git a/open-vm-tools/modules/linux/pvscsi/pvscsi_version.h b/open-vm-tools/modules/linux/pvscsi/pvscsi_version.h index 7156adb4d..6126c06e3 100644 --- a/open-vm-tools/modules/linux/pvscsi/pvscsi_version.h +++ b/open-vm-tools/modules/linux/pvscsi/pvscsi_version.h @@ -25,6 +25,6 @@ #ifndef _PVSCSI_VERSION_H_ #define _PVSCSI_VERSION_H_ -#define PVSCSI_DRIVER_VERSION_STRING "1.0.0.0" +#define PVSCSI_DRIVER_VERSION_STRING "1.0.1.0" #endif /* _PVSCSI_VERSION_H_ */