public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Pylypiv <ipylypiv@google.com>
To: Niklas Cassel <cassel@kernel.org>
Cc: Damien Le Moal <dlemoal@kernel.org>, linux-ide@vger.kernel.org
Subject: Re: [PATCH v2] ata: libata-sata: Use LBA from sense data descriptor
Date: Thu, 10 Apr 2025 10:00:29 -0700	[thread overview]
Message-ID: <Z_f5Lf48v6VNbvpB@google.com> (raw)
In-Reply-To: <Z_fP7RKf5AbybyXB@ryzen>

On Thu, Apr 10, 2025 at 04:04:29PM +0200, Niklas Cassel wrote:
> On Thu, Apr 10, 2025 at 03:02:33PM +0200, Niklas Cassel wrote:
> > 
> > I guess now when we do have access to the information, the most consistent
> > thing would be to fill all field we can in qc->result_tf... but, to do this
> > for every IO might slow things down.
> > 
> > So is there perhaps some logic to only filling LBA (in addition to STATUS
> > and ERROR, which are filled for all NCQ commands), since that is the only
> > field that can change, as per the specs.
> 
> Looking at this more closely:
> https://github.com/torvalds/linux/blob/v6.15-rc1/include/linux/libata.h#L574-L577
> 
> FEATURE is a union with ERROR, so we cannot save it in qc->result_tf.
> 
> COMMAND is a union with STATUS, so we cannot save it in qc->result_tf.
> 
> 
> The sense data descriptor does not provide AUXILIARY, nor DEVICE,
> so we cannot save these.
> 

Successful Sense Data descriptor provides AUXILIARY field as well:

ACS-6 (revision 10)

        Table 339 — Successful Sense Data descriptor format
 +--------+------+-----------------------------------------------------+
 | Offset | Type | Description                                         |
 +--------+------+-----------------------------------------------------+
 | 0      | Byte | SENSE KEY field (see 9.29.3.2)                      |
 | 1      | Byte | ADDITIONAL SENSE CODE field (see 9.29.3.2)          |
 | 2      | Byte | ADDITIONAL SENSE CODE QUALIFIER field (see 9.29.3.2)|
 | 3      | Byte | COMMAND field (see 9.29.3.3)                        |
 | 4      | Byte | FEATURE field (7:0) (see 9.29.3.3)                  |
 | 5      | Byte | FEATURE field (15:8) (see 9.29.3.3)                 |
 | 6      | Byte | COUNT field (7:0) (see 9.29.3.3)                    |
 | 7      | Byte | COUNT field (15:8) (see 9.29.3.3)                   |
 | 8      | Byte | LBA field (7:0) (see 9.29.3.4)                      |
 | 9      | Byte | LBA field (15:8) (see 9.29.3.4)                     |
 | 10     | Byte | LBA field (23:16) (see 9.29.3.4)                    |
 | 11     | Byte | LBA field (31:24) (see 9.29.3.4)                    |
 | 12     | Byte | LBA field (39:32) (see 9.29.3.4)                    |
 | 13     | Byte | LBA field (47:40) (see 9.29.3.4)                    |
 | 14     | Byte | INFORMATION field (7:0) (see 9.29.3.5)              |
 | 15     | Byte | INFORMATION field (15:8) (see 9.29.3.5)             |
 | 16     | Byte | AUXILIARY field (7:0) (see 9.29.3.6)                |
 | 17     | Byte | AUXILIARY field (15:8) (see 9.29.3.6)               |
 | 18     | Byte | AUXILIARY field (23:16) (see 9.29.3.6)              |
 | 19     | Byte | AUXILIARY field (31:24) (see 9.29.3.6)              |
 | 20     | Byte | ICC field (7:0) (see 9.29.3.6)                      |
 | 21..23 | Bytes| Reserved                                            |
 +--------+------+-----------------------------------------------------+  

The data in AUXILIARY and ICC is only valid when the AUXILIARY AND ICC FIELDS
VALID bit is set. Similarly to other fields, AUXILIARY contains a copy of
command inputs.

Thanks,
Igor

> 
> I will send a v3 that does populate COUNT (7:0) and COUNT (15:8),
> since it is only so few fields that we do have, we might as well
> populate them properly.
> 
> 
> Kind regards,
> Niklas

  reply	other threads:[~2025-04-10 17:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  8:45 [PATCH v2] ata: libata-sata: Use LBA from sense data descriptor Niklas Cassel
2025-04-09 17:29 ` Igor Pylypiv
2025-04-10 13:02   ` Niklas Cassel
2025-04-10 14:04     ` Niklas Cassel
2025-04-10 17:00       ` Igor Pylypiv [this message]
2025-04-11  6:35         ` Niklas Cassel
2025-04-11  0:01       ` 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=Z_f5Lf48v6VNbvpB@google.com \
    --to=ipylypiv@google.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@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