Linux ATA/IDE development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>
Cc: cassel@kernel.org, linux-ide@vger.kernel.org, dlemoal@kernel.org
Subject: Re: [PATCH v1 6/6] ata: libata-scsi: support the all command format for reporting supported commands
Date: Thu, 02 Jul 2026 02:11:36 +0000	[thread overview]
Message-ID: <20260702021136.EFDE91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702015646.1702539-7-dlemoal@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incorrect bit-shifting and field conflation for the CDLP and RWCDLP fields corrupts Command Duration Limits (CDL) reporting.
- [Medium] ZBC_IN and VARIABLE_LENGTH_CMD are incorrectly reported as lacking service actions in the All Commands format.
--

commit f7b18a5d6dd37eabc2de02696bfa0461178f0b87
Author: Damien Le Moal <dlemoal@kernel.org>

ata: libata-scsi: support the all command format for reporting supported commands

This commit introduces support for the "All Commands" format (reporting option 0)
in ata_scsi_report_supported_opcodes(). It adds ata_scsi_report_all_supported_opcodes()
to iterate through ata_supported_cmds and report supported operations.

> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 3f313050c63f3..30e2cf3b03dc7 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3731,6 +3731,42 @@ static bool ata_scsi_cmd_is_supported(struct ata_device *dev, u8 op, u16 sa,
[ ... ]
> +static unsigned int
> +ata_scsi_report_all_supported_opcodes(struct ata_device *dev, u8 *rbuf)
> +{
[ ... ]
> +		/* All command format */
> +		if (!ata_scsi_cmd_is_supported(dev, cmd->op, cmd->sa, &sup))
> +			continue;
> +
> +		buf[0] = cmd->op;
> +		put_unaligned_be16(cmd->sa, &buf[2]);
> +		buf[5] |= (sup.rwcdlp << 6) | (sup.cdlp << 2);

[Severity: High]
Does this code correctly shift and map the CDLP and RWCDLP fields?

It looks like sup.rwcdlp is a 1-bit boolean flag (0 for A/B, 1 for T2A/T2B)
used in the One Command format, not the 2-bit RWCDLP enum (01b=Read, 10b=Write)
required for the All Commands format. Shifting 1 by 6 sets bit 6, resulting in
10b, which would incorrectly report READ_16 as a Write command.

Additionally, the CDLP field is defined at bits 4-3, but sup.cdlp is shifted
by 2, placing it at bits 3-2. For WRITE_16 (sup.cdlp=2), shifting by 2 results
in setting bit 3, which falls into the CDLP field as 01b instead of 10b.

> +		if (cmd->sa)
> +			buf[5] |= 0x01;

[Severity: Medium]
Will this correctly set the SERVACTV bit for all commands that require service
actions?

Commands like ZBC_IN (0x95) and VARIABLE_LENGTH_CMD (0x7F) have their service
action explicitly defined as 0x00 in ata_supported_cmds. Since cmd->sa evaluates
to 0, the SERVACTV bit won't be set. This incorrectly tells the host that these
commands do not use the SERVICE ACTION field.

> +		put_unaligned_be16(cmd->cdb_len, &buf[6]);
> +
> +		/* CTDP == 0 */
> +		len += 8;
> +		buf += 8;
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260702015646.1702539-1-dlemoal@kernel.org?part=6

  reply	other threads:[~2026-07-02  2:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  1:56 [PATCH v1 0/6] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 1/6] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 2/6] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 3/6] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02  2:11   ` sashiko-bot
2026-07-02  1:56 ` [PATCH v1 4/6] ata: libata-scsi: improves checks for ZBC_IN and ZBC_OUT commands support Damien Le Moal
2026-07-02  2:07   ` sashiko-bot
2026-07-02  2:19     ` Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 5/6] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-02  2:13   ` sashiko-bot
2026-07-02  1:56 ` [PATCH v1 6/6] ata: libata-scsi: support the all command format for reporting supported commands Damien Le Moal
2026-07-02  2:11   ` sashiko-bot [this message]
2026-07-02  2:27     ` Damien Le Moal

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=20260702021136.EFDE91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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