diff mbox

[5/7] megasas: Implement LD_LIST_QUERY

Message ID 1397632623-26353-6-git-send-email-hare@suse.de
State New
Headers show

Commit Message

Hannes Reinecke April 16, 2014, 7:17 a.m. UTC
New drivers implement a LD_LIST_QUERY command, and due to a driver
issue no drives might be detected if this command isn't supported.
So add emulation for this command, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 hw/scsi/megasas.c | 17 +++++++++++++++++
 hw/scsi/mfi.h     |  9 +++++++++
 trace-events      |  1 +
 3 files changed, 27 insertions(+)

Comments

Alexander Graf April 16, 2014, 11:45 a.m. UTC | #1
On 16.04.14 09:17, Hannes Reinecke wrote:
> New drivers implement a LD_LIST_QUERY command, and due to a driver
> issue no drives might be detected if this command isn't supported.
> So add emulation for this command, too.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>

Should this go into stable? After all it would fix megasas in 2.0, no?


Alex
Hannes Reinecke April 16, 2014, 11:47 a.m. UTC | #2
On 04/16/2014 01:45 PM, Alexander Graf wrote:
> 
> On 16.04.14 09:17, Hannes Reinecke wrote:
>> New drivers implement a LD_LIST_QUERY command, and due to a driver
>> issue no drives might be detected if this command isn't supported.
>> So add emulation for this command, too.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
> 
> Should this go into stable? After all it would fix megasas in 2.0, no?
> 
Yes, presumably.
(I'm not that familiar with qemu policies here)

Cheers,

Hannes
Alexander Graf April 16, 2014, 11:48 a.m. UTC | #3
On 16.04.14 13:47, Hannes Reinecke wrote:
> On 04/16/2014 01:45 PM, Alexander Graf wrote:
>> On 16.04.14 09:17, Hannes Reinecke wrote:
>>> New drivers implement a LD_LIST_QUERY command, and due to a driver
>>> issue no drives might be detected if this command isn't supported.
>>> So add emulation for this command, too.
>>>
>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> Should this go into stable? After all it would fix megasas in 2.0, no?
>>
> Yes, presumably.
> (I'm not that familiar with qemu policies here)

Usually it's the maintainer's responsibility to CC 
qemu-stable@nongnu.org. However, it makes life easier for him if you 
could indicate that you'd like to see it in stable below a --- line in 
the patch description.


Alex
diff mbox

Patch

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 687115e..859b294 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -1130,6 +1130,21 @@  static int megasas_dcmd_ld_get_list(MegasasState *s, MegasasCmd *cmd)
     return MFI_STAT_OK;
 }
 
+static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
+{
+    uint16_t flags;
+
+    /* mbox0 contains flags */
+    flags = le16_to_cpu(cmd->frame->dcmd.mbox[0]);
+    trace_megasas_dcmd_ld_list_query(cmd->index, flags);
+    if (flags == MR_LD_QUERY_TYPE_ALL ||
+        flags == MR_LD_QUERY_TYPE_EXPOSED_TO_HOST) {
+        return megasas_dcmd_ld_get_list(s, cmd);
+    }
+
+    return MFI_STAT_OK;
+}
+
 static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun,
                                       MegasasCmd *cmd)
 {
@@ -1433,6 +1448,8 @@  static const struct dcmd_cmd_tbl_t {
       megasas_dcmd_dummy },
     { MFI_DCMD_LD_GET_LIST, "LD_GET_LIST",
       megasas_dcmd_ld_get_list},
+    { MFI_DCMD_LD_LIST_QUERY, "LD_LIST_QUERY",
+      megasas_dcmd_ld_list_query },
     { MFI_DCMD_LD_GET_INFO, "LD_GET_INFO",
       megasas_dcmd_ld_get_info },
     { MFI_DCMD_LD_GET_PROP, "LD_GET_PROP",
diff --git a/hw/scsi/mfi.h b/hw/scsi/mfi.h
index c365356..b344e4a 100644
--- a/hw/scsi/mfi.h
+++ b/hw/scsi/mfi.h
@@ -171,6 +171,7 @@  typedef enum {
     MFI_DCMD_PD_BLINK =                 0x02070100,
     MFI_DCMD_PD_UNBLINK =               0x02070200,
     MFI_DCMD_LD_GET_LIST =              0x03010000,
+    MFI_DCMD_LD_LIST_QUERY =            0x03010100,
     MFI_DCMD_LD_GET_INFO =              0x03020000,
     MFI_DCMD_LD_GET_PROP =              0x03030000,
     MFI_DCMD_LD_SET_PROP =              0x03040000,
@@ -418,6 +419,14 @@  typedef enum {
     MR_PD_QUERY_TYPE_EXPOSED_TO_HOST =  5, /*query for system drives */
 } mfi_pd_query_type;
 
+typedef enum {
+    MR_LD_QUERY_TYPE_ALL =              0,
+    MR_LD_QUERY_TYPE_EXPOSED_TO_HOST =  1,
+    MR_LD_QUERY_TYPE_USED_TGT_IDS =     2,
+    MR_LD_QUERY_TYPE_CLUSTER_ACCESS =   3,
+    MR_LD_QUERY_TYPE_CLUSTER_LOCALE =   4,
+} mfi_ld_query_type;
+
 /*
  * Other propertities and definitions
  */
diff --git a/trace-events b/trace-events
index e4057e0..e0d65cb 100644
--- a/trace-events
+++ b/trace-events
@@ -664,6 +664,7 @@  megasas_dcmd_ld_get_list(int cmd, int num, int max) "scmd %d: DCMD LD get list:
 megasas_dcmd_ld_get_info(int cmd, int ld_id) "scmd %d: dev %d"
 megasas_dcmd_pd_get_info(int cmd, int pd_id) "scmd %d: dev %d"
 megasas_dcmd_pd_list_query(int cmd, int flags) "scmd %d: query flags %x"
+megasas_dcmd_ld_list_query(int cmd, int flags) "scmd %d: query flags %x"
 megasas_dcmd_unsupported(int cmd, unsigned long size) "scmd %d: set properties len %ld"
 megasas_abort_frame(int cmd, int abort_cmd) "scmd %d: frame %x"
 megasas_abort_no_cmd(int cmd, uint64_t context) "scmd %d: no active command for frame context %" PRIx64 ""