SCSI pull request for 2012-08-28
The following changes since commit 36c6711bbe79642b0102416a9dd4243505e874a6:
target-mips: allow microMIPS SWP and SDP to have RD equal to BASE (2012-08-27 22:18:02 +0200)
are available in the git repository at:
git://github.com/bonzini/qemu.git scsi-next
for you to fetch changes up to df1d7960e7c60e38cdbc1f85d3f78eab753994b0:
iscsi: Set number of blocks to 0 for blank CDROM devices (2012-08-28 13:44:25 +0200)
Yet another megasas pointer misuse, fix for booting from a CD-ROM attached to a PCscsi adapter, and two other small bug fixes.
----------------------------------------------------------------
Hannes Reinecke (1):
megasas: Add 'hba_serial' property
Paolo Bonzini (2):
esp: support 24-bit DMA
scsi: more fixes to properties for passthrough devices
Ronnie Sahlberg (1):
iscsi: Set number of blocks to 0 for blank CDROM devices
block/iscsi.c | 7 ++++++- hw/esp.c | 16 +++++++++++----- hw/megasas.c | 9 +++++++-- hw/scsi-disk.c | 1 + hw/scsi-generic.c | 3 ++-
5 file modificati, 27 inserzioni(+), 9 rimozioni(-)
Signature · 1 line
1.7.11.2
PATCH 1/4 megasas: Add 'hba_serial' property
From: Hannes Reinecke <[email protected]>
Add a 'hba_serial' property to the megasas driver. Originally it would be using a pointer value which would break migration.
--- hw/megasas.c | 9 +++++++--
1 file modificato, 7 inserzioni(+), 2 rimozioni(-)
hw/megasas.c +7 -2
@@ -38,6 +38,7 @@#define MEGASAS_MAX_SECTORS 0xFFFF/* No real limit */ #define MEGASAS_MAX_ARRAYS 128 +#define MEGASAS_HBA_SERIAL "QEMU123456"#define NAA_LOCALLY_ASSIGNED_ID 0x3ULL#define IEEE_COMPANY_LOCALLY_ASSIGNED 0x525400
@@ -93,6 +94,7 @@ typedef struct MegasasState {int boot_event;uint64_t sas_addr; +char *hba_serial;uint64_t reply_queue_pa;void *reply_queue;
@@ -698,8 +700,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd) }memcpy (info.product_name,"MegaRAID SAS 8708EM2" ,20 ); -snprintf (info.serial_number,32 ,"QEMU%08lx" , - (unsigned long )s &0xFFFFFFFF ); +snprintf (info.serial_number,32 ,"%s" , s->hba_serial);snprintf (info.package_version,0x60 ,"%s-QEMU" ,QEMU_VERSION );memcpy (info.image_component[0 ].name,"APP" ,3 );memcpy (info.image_component[0 ].version,MEGASAS_VERSION "-QEMU" ,9 );
@@ -2132,6 +2133,9 @@ static int megasas_scsi_init(PCIDevice *dev) s->sas_addr |= (PCI_SLOT (dev->devfn) <<8 ); s->sas_addr |=PCI_FUNC (dev->devfn); } +if (!s->hba_serial) { + s->hba_serial =g_strdup (MEGASAS_HBA_SERIAL ); + }if (s->fw_sge >=MEGASAS_MAX_SGE -MFI_PASS_FRAME_SIZE ) { s->fw_sge =MEGASAS_MAX_SGE -MFI_PASS_FRAME_SIZE ; }else if (s->fw_sge >=128 -MFI_PASS_FRAME_SIZE ) {
@@ -2166,6 +2170,7 @@ static Property megasas_properties[] = { MEGASAS_DEFAULT_SGE),DEFINE_PROP_UINT32 ("max_cmds" , MegasasState, fw_cmds,MEGASAS_DEFAULT_FRAMES ), +DEFINE_PROP_STRING ("hba_serial" , MegasasState, hba_serial),DEFINE_PROP_HEX64 ("sas_address" , MegasasState, sas_addr,0 ), #ifdef USE_MSIX DEFINE_PROP_BIT("use_msix", MegasasState, flags,
Signature · 1 line
1.7.11.2
PATCH 2/4 esp: support 24-bit DMA
In reply to Paolo BonziniSeaBIOS will issue requests for more than 64k when loading a CD-ROM image into memory. Support the TCHI register from the AMD PCscsi spec.
--- hw/esp.c | 16 +++++++++++-----
1 file modificato, 11 inserzioni(+), 5 rimozioni(-)
hw/esp.c +11 -5
@@ -87,7 +87,9 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf) target = s->wregs[ESP_WBUSID ] &BUSID_DID ;if (s->dma) { - dmalen = s->rregs[ESP_TCLO ] | (s->rregs[ESP_TCMID ] <<8 ); + dmalen = s->rregs[ESP_TCLO ]; + dmalen |= s->rregs[ESP_TCMID ] <<8 ; + dmalen |= s->rregs[ESP_TCHI ] <<16 ; s->dma_memory_read (s->dma_opaque, buf, dmalen); }else { dmalen = s->ti_size;
@@ -226,6 +228,7 @@ static void esp_dma_done(ESPState *s) s->rregs[ESP_RFLAGS ] =0 ; s->rregs[ESP_TCLO ] =0 ; s->rregs[ESP_TCMID ] =0 ; + s->rregs[ESP_TCHI ] =0 ;esp_raise_irq (s); }
@@ -328,7 +331,9 @@ static void handle_ti(ESPState *s)return ; } - dmalen = s->rregs[ESP_TCLO ] | (s->rregs[ESP_TCMID ] <<8 ); + dmalen = s->rregs[ESP_TCLO ]; + dmalen |= s->rregs[ESP_TCMID ] <<8 ; + dmalen |= s->rregs[ESP_TCHI ] <<16 ;if (dmalen==0 ) { dmalen=0x10000 ; }
@@ -429,6 +434,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)switch (saddr) {case ESP_TCLO :case ESP_TCMID : +case ESP_TCHI : s->rregs[ESP_RSTAT ] &= ~STAT_TC ;break ;case ESP_FIFO :
@@ -448,6 +454,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)/* Reload DMA counter. */ s->rregs[ESP_TCLO ] = s->wregs[ESP_TCLO ]; s->rregs[ESP_TCMID ] = s->wregs[ESP_TCMID ]; + s->rregs[ESP_TCHI ] = s->wregs[ESP_TCHI ]; }else { s->dma =0 ; }
@@ -530,13 +537,12 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) case ESP_WBUSID ... ESP_WSYNO:break ;case ESP_CFG1 : +case ESP_CFG2 :case ESP_CFG3 : +case ESP_RES3 :case ESP_RES4 : s->rregs[saddr] = val;break ; case ESP_WCCF ... ESP_WTEST:break ; - case ESP_CFG2 ... ESP_RES4: - s->rregs[saddr] = val; -break ;default :trace_esp_error_invalid_write (val, saddr);return ;
Signature · 1 line
1.7.11.2
PATCH 3/4 scsi: more fixes to properties for passthrough devices
In reply to Paolo BonziniCommit 0384783 (scsi-block: remove properties that are not relevant for passthrough, 2012-07-09) removed one property that should have been left there, "bootindex".
It also did not touch scsi-generic, while it should have.
Fix both problems.
--- hw/scsi-disk.c | 1 + hw/scsi-generic.c | 3 ++-
2 file modificati, 3 inserzioni(+). 1 rimozione(-)
hw/scsi-disk.c +1 -0
@@ -2421,6 +2421,7 @@ static TypeInfo scsi_cd_info = {#ifdef __linux__static Property scsi_block_properties[] = {DEFINE_PROP_DRIVE ("drive" , SCSIDiskState, qdev.conf.bs), +DEFINE_PROP_INT32 ("bootindex" , SCSIDiskState, qdev.conf.bootindex,-1 ),DEFINE_PROP_END_OF_LIST (), };
hw/scsi-generic.c +2 -1
@@ -479,7 +479,8 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun, }static Property scsi_generic_properties[] = { -DEFINE_BLOCK_PROPERTIES (SCSIDevice, conf), +DEFINE_PROP_DRIVE ("drive" , SCSIDevice, conf.bs), +DEFINE_PROP_INT32 ("bootindex" , SCSIDevice, conf.bootindex,-1 ),DEFINE_PROP_END_OF_LIST (), };
Signature · 1 line
1.7.11.2
PATCH 4/4 iscsi: Set number of blocks to 0 for blank CDROM devices
In reply to Paolo BonziniFrom: Ronnie Sahlberg <[email protected]>
The number of blocks of the device is used to compute the device size in bdrv_getlength()/iscsi_getlength().
For MMC devices, the ReturnedLogicalBlockAddress in the READCAPACITY10 has a special meaning when it is 0.
In this case it does not mean that LBA 0 is the last accessible LBA, and thus the device has 1 readable block, but instead it means that the disc is blank and there are no readable blocks.
This change ensures that when the iSCSI LUN is loaded with a blank DVD-R disk or similar that bdrv_getlength() will return the correct size of the device as 0 bytes.
--- block/iscsi.c | 7 ++++++-
1 file modificato, 6 inserzioni(+). 1 rimozione(-)
block/iscsi.c +6 -1
@@ -721,7 +721,12 @@ iscsi_readcapacity10_cb(struct iscsi_context *iscsi, int status, } itask->iscsilun->block_size = rc10->block_size; - itask->iscsilun->num_blocks = rc10->lba +1 ; +if (rc10->lba ==0 ) { +/* blank disk loaded */ + itask->iscsilun->num_blocks =0 ; + }else { + itask->iscsilun->num_blocks = rc10->lba +1 ; + } itask->bs->total_sectors = itask->iscsilun->num_blocks * itask->iscsilun->block_size /BDRV_SECTOR_SIZE ;
Signature · 1 line
1.7.11.2