From: John Garry <john.g.garry@oracle.com>
To: martin.petersen@oracle.com
Cc: target-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, michael.christie@oracle.com,
John Garry <john.g.garry@oracle.com>
Subject: [PATCH v2 5/7] scsi: target: Report atomic values in INQUIRY
Date: Fri, 10 Oct 2025 14:15:06 +0000 [thread overview]
Message-ID: <20251010141508.3695908-6-john.g.garry@oracle.com> (raw)
In-Reply-To: <20251010141508.3695908-1-john.g.garry@oracle.com>
From: Mike Christie <michael.christie@oracle.com>
This reports the atomic values in the Block Limits VPD page.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
jpg: handle not having atomic_supported attribute
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
drivers/target/target_core_spc.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index aad0096afa21c..ddf8104645d1e 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -521,7 +521,6 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
have_tp = 1;
buf[0] = dev->transport->get_device_type(dev);
- buf[3] = have_tp ? 0x3c : 0x10;
/* Set WSNZ to 1 */
buf[4] = 0x01;
@@ -562,11 +561,10 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
else
put_unaligned_be32(dev->dev_attrib.optimal_sectors, &buf[12]);
- /*
- * Exit now if we don't support TP.
- */
+ put_unaligned_be16(12, &buf[2]);
+
if (!have_tp)
- goto max_write_same;
+ goto try_atomic;
/*
* Set MAXIMUM UNMAP LBA COUNT
@@ -595,9 +593,29 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
/*
* MAXIMUM WRITE SAME LENGTH
*/
-max_write_same:
put_unaligned_be64(dev->dev_attrib.max_write_same_len, &buf[36]);
+ put_unaligned_be16(40, &buf[2]);
+
+try_atomic:
+ /*
+ * ATOMIC
+ */
+ if (!dev->dev_attrib.atomic_max_len)
+ goto done;
+
+ if (dev->dev_attrib.atomic_max_len < io_max_blocks)
+ put_unaligned_be32(dev->dev_attrib.atomic_max_len, &buf[44]);
+ else
+ put_unaligned_be32(io_max_blocks, &buf[44]);
+
+ put_unaligned_be32(dev->dev_attrib.atomic_alignment, &buf[48]);
+ put_unaligned_be32(dev->dev_attrib.atomic_granularity, &buf[52]);
+ put_unaligned_be32(dev->dev_attrib.atomic_max_with_boundary, &buf[56]);
+ put_unaligned_be32(dev->dev_attrib.atomic_max_boundary, &buf[60]);
+
+ put_unaligned_be16(60, &buf[2]);
+done:
return 0;
}
--
2.43.5
next prev parent reply other threads:[~2025-10-10 14:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-10 14:15 [PATCH v2 0/7] scsi: target: Add WRITE_ATOMIC_16 support John Garry
2025-10-10 14:15 ` [PATCH v2 1/7] scsi: target: Rename target_configure_unmap_from_queue John Garry
2025-10-10 14:15 ` [PATCH v2 2/7] scsi: target: Add atomic se_device fields John Garry
2025-10-10 14:15 ` [PATCH v2 3/7] scsi: target: Add helper to setup atomic values from block_device John Garry
2025-10-10 14:15 ` [PATCH v2 4/7] scsi: target: Add WRITE_ATOMIC_16 handler John Garry
2025-10-12 1:38 ` kernel test robot
2025-10-10 14:15 ` John Garry [this message]
2025-10-10 14:15 ` [PATCH v2 6/7] scsi: target: Add WRITE_ATOMIC_16 support to RSOC John Garry
2025-10-10 14:15 ` [PATCH v2 7/7] scsi: target: Add atomic support to target_core_iblock John Garry
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=20251010141508.3695908-6-john.g.garry@oracle.com \
--to=john.g.garry@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=target-devel@vger.kernel.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
all inboxes | Powered by JetHome®