From: Igor Pylypiv <ipylypiv@google.com>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Niklas Cassel <cassel@kernel.org>, Tejun Heo <tj@kernel.org>,
Hannes Reinecke <hare@suse.de>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/6] ata: libata-scsi: Check ATA_QCFLAG_RTF_FILLED before using result_tf
Date: Thu, 27 Jun 2024 22:03:26 +0000 [thread overview]
Message-ID: <Zn3hrlF2VW3dWH1f@google.com> (raw)
In-Reply-To: <9c8d751c-8d38-40f4-a88d-cfc39c7b6967@kernel.org>
On Thu, Jun 27, 2024 at 09:19:17AM +0900, Damien Le Moal wrote:
> On 6/27/24 08:04, Igor Pylypiv wrote:
> > qc->result_tf contents are only valid when the ATA_QCFLAG_RTF_FILLED flag
> > is set. The ATA_QCFLAG_RTF_FILLED flag should be always set for commands
> > that failed or for commands that have the ATA_QCFLAG_RESULT_TF flag set.
> >
> > Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
>
> Please change "RTF" to "result TF" in the messages below, to be clear (RTF is
> not). Feel free to split the ata_dev_dbg() lines after "dev," to avoid long lines.
Thanks Damien! I wrote "result taskfile" first, then changed it to "result TF",
and then to "RTF" to shorten the lines :)
I'll change it to "result TF" with the line split in v3.
>
> With that:
>
> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
>
> > ---
> > drivers/ata/libata-scsi.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> > index 02af4d5d5799..d5874d4b9253 100644
> > --- a/drivers/ata/libata-scsi.c
> > +++ b/drivers/ata/libata-scsi.c
> > @@ -242,10 +242,16 @@ void ata_scsi_set_sense_information(struct ata_device *dev,
> > */
> > static void ata_scsi_set_passthru_sense_fields(struct ata_queued_cmd *qc)
> > {
> > + struct ata_device *dev = qc->dev;
> > struct scsi_cmnd *cmd = qc->scsicmd;
> > struct ata_taskfile *tf = &qc->result_tf;
> > unsigned char *sb = cmd->sense_buffer;
> >
> > + if (!(qc->flags & ATA_QCFLAG_RTF_FILLED)) {
> > + ata_dev_dbg(dev, "Missing RTF: cannot set ATA PT sense fields.\n");
> > + return;
> > + }
> > +
> > if ((sb[0] & 0x7f) >= 0x72) {
> > unsigned char *desc;
> > u8 len;
> > @@ -923,10 +929,16 @@ static void ata_to_sense_error(u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
> > */
> > static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
> > {
> > + struct ata_device *dev = qc->dev;
> > struct scsi_cmnd *cmd = qc->scsicmd;
> > struct ata_taskfile *tf = &qc->result_tf;
> > u8 sense_key, asc, ascq;
> >
> > + if (!(qc->flags & ATA_QCFLAG_RTF_FILLED)) {
> > + ata_dev_dbg(dev, "Missing RTF: cannot generate ATA PT sense data.\n");
> > + return;
> > + }
> > +
> > /*
> > * Use ata_to_sense_error() to map status register bits
> > * onto sense key, asc & ascq.
> > @@ -970,6 +982,12 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
> > ata_scsi_set_sense(dev, cmd, NOT_READY, 0x04, 0x21);
> > return;
> > }
> > +
> > + if (!(qc->flags & ATA_QCFLAG_RTF_FILLED)) {
> > + ata_dev_dbg(dev, "Missing RTF: cannot generate sense data.\n");
> > + return;
> > + }
> > +
> > /* Use ata_to_sense_error() to map status register bits
> > * onto sense key, asc & ascq.
> > */
>
> --
> Damien Le Moal
> Western Digital Research
>
Thanks,
Igor
next prev parent reply other threads:[~2024-06-27 22:03 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 23:04 [PATCH v3 0/6] ATA PASS-THROUGH sense data fixes Igor Pylypiv
2024-06-26 23:04 ` [PATCH v3 1/6] ata: libata-scsi: Fix offsets for the fixed format sense data Igor Pylypiv
2024-06-27 12:08 ` Niklas Cassel
2024-06-27 21:21 ` Igor Pylypiv
2024-06-28 6:47 ` Hannes Reinecke
2024-06-28 15:49 ` Niklas Cassel
2024-06-28 18:25 ` Niklas Cassel
2024-06-28 23:17 ` Igor Pylypiv
2024-06-26 23:04 ` [PATCH v3 2/6] ata: libata-scsi: Do not overwrite valid sense data when CK_COND=1 Igor Pylypiv
2024-06-27 0:16 ` Damien Le Moal
2024-06-27 20:55 ` Igor Pylypiv
2024-06-28 3:48 ` Damien Le Moal
2024-06-27 14:14 ` Niklas Cassel
2024-06-27 15:15 ` Niklas Cassel
2024-06-27 21:54 ` Igor Pylypiv
2024-06-28 18:44 ` Niklas Cassel
2024-06-28 23:31 ` Igor Pylypiv
2024-06-29 3:09 ` Niklas Cassel
2024-07-01 20:00 ` Igor Pylypiv
2024-06-26 23:04 ` [PATCH v3 3/6] ata: libata-scsi: Remove redundant sense_buffer memsets Igor Pylypiv
2024-06-26 23:04 ` [PATCH v3 4/6] ata: libata-scsi: Do not pass ATA device id to ata_to_sense_error() Igor Pylypiv
2024-06-26 23:04 ` [PATCH v3 5/6] ata: libata: Set ATA_QCFLAG_RTF_FILLED in fill_result_tf() Igor Pylypiv
2024-06-28 20:12 ` Niklas Cassel
2024-06-28 23:08 ` Igor Pylypiv
2024-06-26 23:04 ` [PATCH v3 6/6] ata: libata-scsi: Check ATA_QCFLAG_RTF_FILLED before using result_tf Igor Pylypiv
2024-06-27 0:19 ` Damien Le Moal
2024-06-27 22:03 ` Igor Pylypiv [this message]
2024-06-27 6:16 ` Hannes Reinecke
2024-06-28 19:42 ` Niklas Cassel
2024-06-28 23:15 ` Igor Pylypiv
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=Zn3hrlF2VW3dWH1f@google.com \
--to=ipylypiv@google.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hare@suse.de \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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