From: Xingui Yang <yangxingui@huawei.com>
To: <James.Bottomley@HansenPartnership.com>,
<martin.petersen@oracle.com>, <john.g.garry@oracle.com>,
<dlemoal@kernel.org>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, <yangxingui@huawei.com>,
<liuyonglong@huawei.com>, <kangfenglong@huawei.com>
Subject: [PATCH v2 1/2] scsi: scsi_lib: add spinup_notify callback for ASC/ASCQ=0x04/0x11
Date: Fri, 3 Jul 2026 10:28:32 +0800 [thread overview]
Message-ID: <20260703022833.36847-2-yangxingui@huawei.com> (raw)
In-Reply-To: <20260703022833.36847-1-yangxingui@huawei.com>
When a SCSI device returns NOT_READY with ASC/ASCQ = 0x04/0x11
("notify (enable spinup) required"), the device is in Active_Wait or
Idle_Wait power state and will not respond to standard START_STOP
spinup commands.
Add an optional spinup_notify callback to struct scsi_host_template.
When ASCQ=0x11 is detected in the mid-layer, invoke this callback
before ACTION_DELAYED_RETRY, allowing LLDDs to perform controller-
specific spinup notification.
Example log:
[Tue Jun 23 08:34:44 2026] sd 4:0:9:0: [sde] Spinning up disk...
[Tue Jun 23 08:36:22 2026] ...not responding...
[Tue Jun 23 08:36:24 2026] sd 4:0:9:0: [sde] Sense Key : Not Ready
[Tue Jun 23 08:36:24 2026] sd 4:0:9:0: [sde] Add. Sense: Logical unit
not ready, notify (enable spinup) required
Signed-off-by: Xingui Yang <yangxingui@huawei.com>
---
drivers/scsi/scsi_lib.c | 4 ++++
include/scsi/scsi_host.h | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b67f0dc79499..33c4339ca8c5 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -905,6 +905,10 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
case 0x1a: /* start stop unit in progress */
case 0x1b: /* sanitize in progress */
case 0x1d: /* configuration in progress */
+ if (sshdr.ascq == 0x11 &&
+ cmd->device->host->hostt->spinup_notify)
+ cmd->device->host->hostt->spinup_notify(
+ cmd->device);
action = ACTION_DELAYED_RETRY;
break;
case 0x0a: /* ALUA state transition */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 7e2011830ba4..22bf2d3d9b36 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -374,6 +374,18 @@ struct scsi_host_template {
#define SCSI_ADAPTER_RESET 1
#define SCSI_FIRMWARE_RESET 2
+ /*
+ * Optional callback invoked when a device returns NOT_READY with
+ * ASC/ASCQ = 0x04/0x11 ("notify (enable spinup) required").
+ * This allows LLDDs to perform controller-specific spinup
+ * notification before the mid-layer retries.
+ *
+ * Context: Called from softirq (block layer completion) context.
+ * Implementations must not sleep or schedule.
+ *
+ * Status: OPTIONAL
+ */
+ void (*spinup_notify)(struct scsi_device *sdev);
/*
* Name of proc directory
--
2.43.0
next prev parent reply other threads:[~2026-07-03 2:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 2:28 [PATCH v2 0/2] scsi: support spinup notification for SAS SSP devices in Active_Wait/Idle_Wait state Xingui Yang
2026-07-03 2:28 ` Xingui Yang [this message]
2026-07-03 2:28 ` [PATCH v2 2/2] scsi: hisi_sas: add spinup_notify callback to handle Active_Wait/Idle_Wait SSP devices Xingui Yang
2026-07-03 2:45 ` sashiko-bot
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=20260703022833.36847-2-yangxingui@huawei.com \
--to=yangxingui@huawei.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dlemoal@kernel.org \
--cc=john.g.garry@oracle.com \
--cc=kangfenglong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=martin.petersen@oracle.com \
/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