qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for 1.2 0/4] SCSI pull request for 2012-08-28
@ 2012-08-28 12:52 Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 1/4] megasas: Add 'hba_serial' property Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-08-28 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

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(-)
-- 
1.7.11.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH for 1.2 1/4] megasas: Add 'hba_serial' property
  2012-08-28 12:52 [Qemu-devel] [PULL for 1.2 0/4] SCSI pull request for 2012-08-28 Paolo Bonzini
@ 2012-08-28 12:52 ` Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 2/4] esp: support 24-bit DMA Paolo Bonzini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-08-28 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, Hannes Reinecke

From: Hannes Reinecke <hare@suse.de>

Add a 'hba_serial' property to the megasas driver. Originally
it would be using a pointer value which would break migration.

Reported-by: Stefan Weil <sw@weilnetz.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/megasas.c | 9 +++++++--
 1 file modificato, 7 inserzioni(+), 2 rimozioni(-)

diff --git a/hw/megasas.c b/hw/megasas.c
index c35a15d..c728aea 100644
--- a/hw/megasas.c
+++ b/hw/megasas.c
@@ -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,
-- 
1.7.11.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH for 1.2 2/4] esp: support 24-bit DMA
  2012-08-28 12:52 [Qemu-devel] [PULL for 1.2 0/4] SCSI pull request for 2012-08-28 Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 1/4] megasas: Add 'hba_serial' property Paolo Bonzini
@ 2012-08-28 12:52 ` Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 3/4] scsi: more fixes to properties for passthrough devices Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 4/4] iscsi: Set number of blocks to 0 for blank CDROM devices Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-08-28 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

SeaBIOS will issue requests for more than 64k when loading a CD-ROM
image into memory.  Support the TCHI register from the AMD PCscsi
spec.

Acked-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/esp.c | 16 +++++++++++-----
 1 file modificato, 11 inserzioni(+), 5 rimozioni(-)

diff --git a/hw/esp.c b/hw/esp.c
index 52c46e6..84a4e74 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -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;
-- 
1.7.11.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH for 1.2 3/4] scsi: more fixes to properties for passthrough devices
  2012-08-28 12:52 [Qemu-devel] [PULL for 1.2 0/4] SCSI pull request for 2012-08-28 Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 1/4] megasas: Add 'hba_serial' property Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 2/4] esp: support 24-bit DMA Paolo Bonzini
@ 2012-08-28 12:52 ` Paolo Bonzini
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 4/4] iscsi: Set number of blocks to 0 for blank CDROM devices Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-08-28 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

Commit 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.

Reported-by: Alexandre DERUMIER <aderumier@odiso.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi-disk.c    | 1 +
 hw/scsi-generic.c | 3 ++-
 2 file modificati, 3 inserzioni(+). 1 rimozione(-)

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 409f760..21b862d 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -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(),
 };
 
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 8d51060..a5eb663 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -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(),
 };
 
-- 
1.7.11.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH for 1.2 4/4] iscsi: Set number of blocks to 0 for blank CDROM devices
  2012-08-28 12:52 [Qemu-devel] [PULL for 1.2 0/4] SCSI pull request for 2012-08-28 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 3/4] scsi: more fixes to properties for passthrough devices Paolo Bonzini
@ 2012-08-28 12:52 ` Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-08-28 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, Ronnie Sahlberg

From: Ronnie Sahlberg <ronniesahlberg@gmail.com>

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.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
---
 block/iscsi.c | 7 ++++++-
 1 file modificato, 6 inserzioni(+). 1 rimozione(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 4828b83..0b96165 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -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 ;
 
-- 
1.7.11.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-28 12:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-28 12:52 [Qemu-devel] [PULL for 1.2 0/4] SCSI pull request for 2012-08-28 Paolo Bonzini
2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 1/4] megasas: Add 'hba_serial' property Paolo Bonzini
2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 2/4] esp: support 24-bit DMA Paolo Bonzini
2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 3/4] scsi: more fixes to properties for passthrough devices Paolo Bonzini
2012-08-28 12:52 ` [Qemu-devel] [PATCH for 1.2 4/4] iscsi: Set number of blocks to 0 for blank CDROM devices Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).