All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: "Reimar Döffinger" <Reimar.Doeffinger@gmx.de>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"Jens Axboe" <axboe@kernel.dk>,
	"hch@infradead.org" <hch@infradead.org>
Subject: Re: [PATCH] libata: fix setting and checking of DMA state.
Date: Wed, 18 Aug 2021 23:30:48 +0000	[thread overview]
Message-ID: <DM6PR04MB7081AB7034F116CDFBA43890E7FF9@DM6PR04MB7081.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210817190308.29065-1-Reimar.Doeffinger@gmx.de

On 2021/08/18 4:03, Reimar Döffinger wrote:
> Checking if DMA is enabled should be done via the
> ata_dma_enabled helper function.
> Update dma_mode initialization so that SATA devices
> are reported as DMA enabled.

Please drop the period at the end of the patch title

> ---
>  drivers/ata/libata-core.c | 4 ++--
>  include/linux/ata.h       | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 9934f6c465f4..a5fe20bb22d6 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -2004,7 +2004,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) &&

This change is OK I think. Note that there are many other places where
dev->dma_mode is testing directly. It may be good to check those too.

>  	    !(dev->horkage & ATA_HORKAGE_NO_DMA_LOG)) {
>  		tf.command = ATA_CMD_READ_LOG_DMA_EXT;
>  		tf.protocol = ATA_PROT_DMA;
> @@ -2824,7 +2824,7 @@ int ata_bus_probe(struct ata_port *ap)
>  		 * bus as we may be talking too fast.
>  		 */
>  		dev->pio_mode = XFER_PIO_0;
> -		dev->dma_mode = 0xff;
> +		dev->dma_mode = ap->flags & ATA_FLAG_SATA ? XFER_SATA : 0xff;

This however is not OK I think. You are setting a transfer speed without going
through the link speed negotiation.

>  
>  		/* If the controller has a pio mode setup function
>  		 * then use it to set the chipset to rights. Don't
> diff --git a/include/linux/ata.h b/include/linux/ata.h
> index 1b44f40c7700..7bb2c2acbc42 100644
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -374,6 +374,7 @@ enum {
>  
>  	/* SETFEATURES stuff */
>  	SETFEATURES_XFER	= 0x03,
> +	XFER_SATA               = 0x48,

Where does this come from ?

>  	XFER_UDMA_7		= 0x47,
>  	XFER_UDMA_6		= 0x46,
>  	XFER_UDMA_5		= 0x45,
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2021-08-18 23:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14 13:47 [PATCH] libata: add kernel parameter to force ATA_HORKAGE_NO_DMA_LOG Reimar Döffinger
2021-08-15  8:18 ` Christoph Hellwig
2021-08-15 16:27   ` [PATCH] libata: Disable ATA_CMD_READ_LOG_DMA_EXT in problematic cases Reimar Döffinger
2021-08-16  0:10     ` Damien Le Moal
2021-08-16 17:15       ` Reimar Döffinger
2021-08-17 19:06         ` Reimar Döffinger
2021-08-18 22:49         ` Damien Le Moal
2021-08-16 17:26       ` Reimar Döffinger
2021-08-17  7:45         ` Damien Le Moal
2021-08-17 18:01           ` Reimar Döffinger
2021-08-17 19:03             ` [PATCH] libata: fix setting and checking of DMA state Reimar Döffinger
2021-08-18 23:30               ` Damien Le Moal [this message]
2021-08-19  8:13                 ` [PATCH] libata: fix " Reimar Döffinger
2021-08-19 12:56                   ` Reimar Döffinger
2021-09-27  8:56                   ` Paul Menzel
2021-09-27  9:10                     ` Reimar Döffinger
2021-09-27  9:15                       ` 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
2021-10-03 13:28                           ` [PATCH 2/6] libata-scsi: " Reimar Döffinger
2021-10-03 13:28                           ` [PATCH 3/6] pata_ali: " Reimar Döffinger
2021-10-03 13:28                           ` [PATCH 4/6] pata_amd: " Reimar Döffinger
2021-10-03 13:28                           ` [PATCH 5/6] pata_optidma: " Reimar Döffinger
2021-10-03 13:28                           ` [PATCH 6/6] pata_radisys: " Reimar Döffinger
2021-10-12  2:20                           ` [PATCH v4] Fixes to DMA state check Damien Le Moal
2021-10-12  6:30                             ` Reimar Döffinger
     [not found]                             ` <605EE991-5DA2-4A8D-9691-967D68D3AB51@gmx.de>
2021-10-12  6:32                               ` Damien Le Moal
2021-10-12  6:33                               ` Damien Le Moal
2021-08-15 16:34   ` [PATCH] libata: add kernel parameter to force ATA_HORKAGE_NO_DMA_LOG 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=DM6PR04MB7081AB7034F116CDFBA43890E7FF9@DM6PR04MB7081.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=Reimar.Doeffinger@gmx.de \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.