linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Reimar Döffinger" <Reimar.Doeffinger@gmx.de>
To: Damien Le Moal <Damien.LeMoal@wdc.com>,
	linux-ide@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	hch@infradead.org, Paul Menzel <pmenzel@molgen.mpg.de>
Subject: [PATCH 1/6] libata: fix checking of DMA state
Date: Tue, 12 Oct 2021 08:27:44 +0200	[thread overview]
Message-ID: <20211012062749.4728-2-Reimar.Doeffinger@gmx.de> (raw)
In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de>

Checking if DMA is enabled should be done via the
ata_dma_enabled helper function, since the init state
0xff indicates disabled.
This meant that ATA_CMD_READ_LOG_DMA_EXT was used and probed
for before DMA was enabled, which caused hangs for some combinations
of controllers and devices.
It might also have caused it to be incorrectly disabled as broken,
but there have been no reports of that.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=195895
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
 drivers/ata/libata-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index eed65311b5d1..046faf0dbdd3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2007,7 +2007,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
 
 retry:
 	ata_tf_init(dev, &tf);
-	if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id) &&
+	if (ata_dma_enabled(dev) && ata_id_has_read_log_dma_ext(dev->id) &&
 	    !(dev->horkage & ATA_HORKAGE_NO_DMA_LOG)) {
 		tf.command = ATA_CMD_READ_LOG_DMA_EXT;
 		tf.protocol = ATA_PROT_DMA;
-- 
2.33.0


  reply	other threads:[~2021-10-12  6:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  6:27 [PATCH v5] Fixes to DMA state check Reimar Döffinger
2021-10-12  6:27 ` Reimar Döffinger [this message]
2021-10-12  6:27 ` [PATCH 2/6] libata-scsi: fix checking of DMA state Reimar Döffinger
2021-10-12  6:27 ` [PATCH 3/6] pata_ali: " Reimar Döffinger
2021-10-12  6:27 ` [PATCH 4/6] pata_amd: " Reimar Döffinger
2021-10-12  6:27 ` [PATCH 5/6] pata_optidma: " Reimar Döffinger
2021-10-12  6:27 ` [PATCH 6/6] pata_radisys: " Reimar Döffinger
  -- strict thread matches above, loose matches on Subject: below --
2021-09-27  9:15 [PATCH] libata: " Damien Le Moal
2021-10-03 13:28 ` [PATCH v4] Fixes to DMA state check Reimar Döffinger
2021-10-03 13:28   ` [PATCH 1/6] libata: fix checking of DMA state Reimar Döffinger

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=20211012062749.4728-2-Reimar.Doeffinger@gmx.de \
    --to=reimar.doeffinger@gmx.de \
    --cc=Damien.LeMoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    /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;
as well as URLs for NNTP newsgroup(s).