From: Greg Kroah-Hartman Date: Wed, 29 Jan 2025 09:08:46 +0000 (+0100) Subject: 6.6-stable patches X-Git-Tag: v6.13.1~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2fa5355308fa6a1aa1a571d95ff0f4f3bb5a24db;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: ata-libata-core-set-ata_qcflag_rtf_filled-in-fill_result_tf.patch --- diff --git a/queue-6.6/ata-libata-core-set-ata_qcflag_rtf_filled-in-fill_result_tf.patch b/queue-6.6/ata-libata-core-set-ata_qcflag_rtf_filled-in-fill_result_tf.patch new file mode 100644 index 0000000000..52121b425e --- /dev/null +++ b/queue-6.6/ata-libata-core-set-ata_qcflag_rtf_filled-in-fill_result_tf.patch @@ -0,0 +1,97 @@ +From 18676c6aab0863618eb35443e7b8615eea3535a9 Mon Sep 17 00:00:00 2001 +From: Igor Pylypiv +Date: Tue, 2 Jul 2024 02:47:34 +0000 +Subject: ata: libata-core: Set ATA_QCFLAG_RTF_FILLED in fill_result_tf() + +From: Igor Pylypiv + +commit 18676c6aab0863618eb35443e7b8615eea3535a9 upstream. + +ATA_QCFLAG_RTF_FILLED is not specific to ahci and can be used generally +to check if qc->result_tf contains valid data. + +Reviewed-by: Hannes Reinecke +Reviewed-by: Damien Le Moal +Reviewed-by: Niklas Cassel +Signed-off-by: Igor Pylypiv +Link: https://lore.kernel.org/r/20240702024735.1152293-7-ipylypiv@google.com +Signed-off-by: Niklas Cassel +Cc: Christian Kühnke +Signed-off-by: Greg Kroah-Hartman +--- + drivers/ata/libahci.c | 12 ++---------- + drivers/ata/libata-core.c | 8 ++++++++ + 2 files changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/ata/libahci.c ++++ b/drivers/ata/libahci.c +@@ -2082,13 +2082,6 @@ static void ahci_qc_fill_rtf(struct ata_ + struct ahci_port_priv *pp = qc->ap->private_data; + u8 *rx_fis = pp->rx_fis; + +- /* +- * rtf may already be filled (e.g. for successful NCQ commands). +- * If that is the case, we have nothing to do. +- */ +- if (qc->flags & ATA_QCFLAG_RTF_FILLED) +- return; +- + if (pp->fbs_enabled) + rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; + +@@ -2102,7 +2095,6 @@ static void ahci_qc_fill_rtf(struct ata_ + !(qc->flags & ATA_QCFLAG_EH)) { + ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf); + qc->result_tf.status = (rx_fis + RX_FIS_PIO_SETUP)[15]; +- qc->flags |= ATA_QCFLAG_RTF_FILLED; + return; + } + +@@ -2125,12 +2117,10 @@ static void ahci_qc_fill_rtf(struct ata_ + */ + qc->result_tf.status = fis[2]; + qc->result_tf.error = fis[3]; +- qc->flags |= ATA_QCFLAG_RTF_FILLED; + return; + } + + ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf); +- qc->flags |= ATA_QCFLAG_RTF_FILLED; + } + + static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask) +@@ -2165,6 +2155,7 @@ static void ahci_qc_ncq_fill_rtf(struct + if (qc && ata_is_ncq(qc->tf.protocol)) { + qc->result_tf.status = status; + qc->result_tf.error = error; ++ qc->result_tf.flags = qc->tf.flags; + qc->flags |= ATA_QCFLAG_RTF_FILLED; + } + done_mask &= ~(1ULL << tag); +@@ -2189,6 +2180,7 @@ static void ahci_qc_ncq_fill_rtf(struct + fis += RX_FIS_SDB; + qc->result_tf.status = fis[2]; + qc->result_tf.error = fis[3]; ++ qc->result_tf.flags = qc->tf.flags; + qc->flags |= ATA_QCFLAG_RTF_FILLED; + } + done_mask &= ~(1ULL << tag); +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -4792,8 +4792,16 @@ static void fill_result_tf(struct ata_qu + { + struct ata_port *ap = qc->ap; + ++ /* ++ * rtf may already be filled (e.g. for successful NCQ commands). ++ * If that is the case, we have nothing to do. ++ */ ++ if (qc->flags & ATA_QCFLAG_RTF_FILLED) ++ return; ++ + qc->result_tf.flags = qc->tf.flags; + ap->ops->qc_fill_rtf(qc); ++ qc->flags |= ATA_QCFLAG_RTF_FILLED; + } + + static void ata_verify_xfer(struct ata_queued_cmd *qc) diff --git a/queue-6.6/series b/queue-6.6/series index a4aeab3f93..7014efc2c1 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -7,3 +7,4 @@ of-unittest-add-test-that-of_address_to_resource-fai.patch irqchip-sunxi-nmi-add-missing-skip_wake-flag.patch hwmon-drivetemp-set-scsi-command-timeout-to-10s.patch asoc-samsung-add-missing-depends-on-i2c.patch +ata-libata-core-set-ata_qcflag_rtf_filled-in-fill_result_tf.patch