qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: qemu-devel@nongnu.org
Cc: Hannes Reinecke <hare@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Nic Bellinger <nab@datera.com>,
	Andreas Faerber <afaerber@suse.de>,
	Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 12/17] megasas: Clear unit attention on initial reset
Date: Wed, 29 Oct 2014 08:53:47 +0100	[thread overview]
Message-ID: <1414569232-21357-13-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1414569232-21357-1-git-send-email-hare@suse.de>

The EFI firmware doesn't handle unit attentions properly,
so we need to clear the Power On/Reset unit attention upon
initial reset.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 hw/scsi/megasas.c | 20 +++++++++++++++++++-
 trace-events      |  2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 56336b0..7a6c94f 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2203,11 +2203,28 @@ static void megasas_soft_reset(MegasasState *s)
     int i;
     MegasasCmd *cmd;
 
-    trace_megasas_reset();
+    trace_megasas_reset(s->fw_state);
     for (i = 0; i < s->fw_cmds; i++) {
         cmd = &s->frames[i];
         megasas_abort_command(cmd);
     }
+    if (s->fw_state == MFI_FWSTATE_READY) {
+        BusChild *kid;
+
+        /*
+         * The EFI firmware doesn't handle UA,
+         * so we need to clear the Power On/Reset UA
+         * after the initial reset.
+         */
+        QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) {
+            SCSIDevice *sdev = DO_UPCAST(SCSIDevice, qdev, kid->child);
+            SCSISense *ua;
+
+            ua = &sdev->unit_attention;
+            *ua = SENSE_CODE(NO_SENSE);
+            sdev->sense_is_ua = false;
+        }
+    }
     megasas_reset_frames(s);
     s->reply_queue_len = s->fw_cmds;
     s->reply_queue_pa = 0;
@@ -2335,6 +2352,7 @@ static int megasas_scsi_init(PCIDevice *dev)
         msix_vector_use(dev, 0);
     }
 
+    s->fw_state = MFI_FWSTATE_READY;
     if (!s->sas_addr) {
         s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) |
                        IEEE_COMPANY_LOCALLY_ASSIGNED) << 36;
diff --git a/trace-events b/trace-events
index 69b95f5..11cfc44 100644
--- a/trace-events
+++ b/trace-events
@@ -754,7 +754,7 @@ megasas_dcmd_unsupported(int cmd, unsigned long size) "scmd %d: set properties l
 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 ""
 megasas_abort_invalid_context(int cmd, uint64_t context, int abort_cmd) "scmd %d: invalid frame context %" PRIx64 " for abort frame %x"
-megasas_reset(void) "Reset"
+megasas_reset(int fw_state) "firmware state %x"
 megasas_init(int sges, int cmds, const char *mode) "Using %d sges, %d cmds, %s mode"
 megasas_msix_raise(int vector) "vector %d"
 megasas_msi_raise(int vector) "vector %d"
-- 
1.8.4.5

  parent reply	other threads:[~2014-10-29  7:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29  7:53 [Qemu-devel] [PATCH 00/17] megasas: gen2 emulation and MSI-X fixes Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 01/17] ahci: Fix CD-ROM signature Hannes Reinecke
2014-10-29  8:07   ` Markus Armbruster
2014-10-29  8:11     ` Hannes Reinecke
2014-10-29 15:47       ` John Snow
2014-10-29 14:30   ` Stefan Hajnoczi
2014-10-29  7:53 ` [Qemu-devel] [PATCH 02/17] atapi: clear sense code Hannes Reinecke
2014-10-29 14:50   ` Stefan Hajnoczi
2014-10-29  7:53 ` [Qemu-devel] [PATCH 03/17] scsi: Rename scsi_cdb_length() to scsi_xfer_length() Hannes Reinecke
2014-10-30 10:38   ` Paolo Bonzini
2014-10-30 11:26     ` Hannes Reinecke
2014-10-30 12:00       ` Paolo Bonzini
2014-10-29  7:53 ` [Qemu-devel] [PATCH 04/17] scsi: fixup lba calculation for 6 byte CDBs Hannes Reinecke
2014-10-29  9:16   ` Paolo Bonzini
2014-10-29  9:52     ` Hannes Reinecke
2014-10-29 10:10       ` Paolo Bonzini
2014-10-29  7:53 ` [Qemu-devel] [PATCH 05/17] scsi: Remove 'lun' argument Hannes Reinecke
2014-10-29  9:05   ` Paolo Bonzini
2014-10-29  9:07   ` Paolo Bonzini
2014-10-29 11:13     ` Hannes Reinecke
2014-10-29 11:35       ` Paolo Bonzini
2014-10-29  7:53 ` [Qemu-devel] [PATCH 06/17] megasas: fixup MFI_DCMD_LD_LIST_QUERY Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 07/17] megasas: simplify trace event messages Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 08/17] megasas: fixup device mapping Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 09/17] megasas: add MegaRAID SAS 2108 emulation Hannes Reinecke
2014-10-29 12:01   ` Andreas Färber
2014-10-29  7:53 ` [Qemu-devel] [PATCH 10/17] megasas: Fix typo in megasas_dcmd_ld_get_list() Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 11/17] megasas: Decode register names Hannes Reinecke
2014-10-29  7:53 ` Hannes Reinecke [this message]
2014-10-29  9:14   ` [Qemu-devel] [PATCH 12/17] megasas: Clear unit attention on initial reset Paolo Bonzini
2014-10-29  9:53     ` Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 13/17] megasas: Ignore duplicate init_firmware commands Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 14/17] megasas: Implement DCMD_CLUSTER_RESET_LD Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 15/17] megasas: Update queue logging Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 16/17] megasas: Rework frame queueing algorithm Hannes Reinecke
2014-10-29  7:53 ` [Qemu-devel] [PATCH 17/17] megasas: Fixup MSI-X handling Hannes Reinecke
2014-10-29  9:18 ` [Qemu-devel] [PATCH 00/17] megasas: gen2 emulation and MSI-X fixes Paolo Bonzini
2014-10-29 11:10   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414569232-21357-13-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=nab@datera.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).