From patchwork Tue Aug 17 19:03:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1517805 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Gq0mR5NtNz9sPf for ; Wed, 18 Aug 2021 05:03:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbhHQTDv (ORCPT ); Tue, 17 Aug 2021 15:03:51 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:37911 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229821AbhHQTDv (ORCPT ); Tue, 17 Aug 2021 15:03:51 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MMGZM-1mXBF429g6-00JIMw; Tue, 17 Aug 2021 21:03:08 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org Subject: [PATCH] libata: fix setting and checking of DMA state. Date: Tue, 17 Aug 2021 21:03:07 +0200 Message-Id: <20210817190308.29065-1-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:OBR85YcLyt7UFAQFar+p7ul4yKPVxzmFmeJ/xMcH+LWl+evQu+2 qSPmu2PQOoFjRyBCsxbGvrSfVf2T11KO8MmvYa4xYQkg4VKguWm4YO+9Scxh4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kPmf8Qi6ohNKtbg== Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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. --- 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) && !(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; /* 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, XFER_UDMA_7 = 0x47, XFER_UDMA_6 = 0x46, XFER_UDMA_5 = 0x45,