From patchwork Tue Oct 12 06:27:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1539582 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 bilbo.ozlabs.org (Postfix) with ESMTP id 4HT5Ms1SKFz9ssD for ; Tue, 12 Oct 2021 17:28:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbhJLGak (ORCPT ); Tue, 12 Oct 2021 02:30:40 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:34631 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbhJLGag (ORCPT ); Tue, 12 Oct 2021 02:30:36 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M3D3N-1mb0DI0mYH-003cLI; Tue, 12 Oct 2021 08:28:13 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org, Paul Menzel Subject: [PATCH 1/6] libata: fix checking of DMA state Date: Tue, 12 Oct 2021 08:27:44 +0200 Message-Id: <20211012062749.4728-2-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> References: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:RMPRyvaBEtnClBp+K0wv7rOPZEZWFt7VuVlzzKXQ66tqkbnfjFG 5o7kRisXFDA9l4tzSsSnjlNVDabkj+D6ynvIDvZl1vygcUnUGE0VVBiMznRVT2u1ItSACr+ Mi1DIuh6mVhXuDLX2sukp8QCCCYYlbtFhAeHtZrMB69xevS+/OXBcO9kLZB0GPb6UzD1ff2 8AaclvIqzLxxgMvj6jbrw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:J0YyJJBD1uY=:ibpihMhGJWjBRVEOYt7iZJ tNcYtRivOlDCdRQmkQAx046Y9Ut2zKeWqH2jIsyTOP1OHU9fuLFZ0mft3GftM5CyZHX6dBKuL oB7P27+KsJHby7mV/Ib4D+L07uAVsV0b160p4xPKM5BtJZJXSInYS8u103GuNIOMzoxuPYa46 7DZ6GOmqDyz3ua7CVWcXFCp5Ph2OthG+90kZeRWp+d+VLCdWCE3eDE5iMvKqm8zj/z1aEnI14 b0MlmJaIbE52BEyuaLVzXekdWQFBl9nLzJ9k1ceJj/usGCAPO8EflpXF5ztusINJKmnVbE53i b9WPgC9kpVrpq9F1lZsQwYiOasfIqiln93sg9BSF/3E7F+Pu0xsBJnbi2FP2USRiazkC6XUpg Rb6UW/rZ2jE7lQpkUzFdsXdtQXl3bsKZ2b2/pU7hTmuVMWGk5cBKcD0NafnjqlGDGatVpebHa N6m/ICKEaJ32gJqj0rv7g+uud5dHPeQ5Bhn0Ww6/ct+Cn2xmRenqGwDhsx2Sn5bYZKxRyehQ4 99J3il1KLpcXTjMoQi0m2c6914A2yXQK1Gl8OchGgA/JDZ24k9Qpg7NCpM2EI+LO/RSxZ/Sfr HK8qBeBe3tpdVhTzByrabsCfMLkildWq0YcLkS/PoykehpnNJHMzT6CoSsC93TbQv/RLlBmtR Hx81mP6dMtQekgmFeKbIAEVVpzNJoL8bOI9R6iF3DoMOzuVPcXtxbkIICvD5ddrt3SoH1xaeS eMolVkiNbu+S2/DcuG6KPOrqgaQ3YENHDF+3l9uaBQgcrQYI74ZogazPpaE= 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, 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 Tested-by: Paul Menzel --- 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; From patchwork Tue Oct 12 06:27:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1539586 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 bilbo.ozlabs.org (Postfix) with ESMTP id 4HT5Mw5sYnz9sX3 for ; Tue, 12 Oct 2021 17:28:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232995AbhJLGap (ORCPT ); Tue, 12 Oct 2021 02:30:45 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:57247 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbhJLGak (ORCPT ); Tue, 12 Oct 2021 02:30:40 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N4yJ8-1mi3VC2ege-010xrn; Tue, 12 Oct 2021 08:28:14 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org, Paul Menzel Subject: [PATCH 2/6] libata-scsi: fix checking of DMA state Date: Tue, 12 Oct 2021 08:27:45 +0200 Message-Id: <20211012062749.4728-3-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> References: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:RSnP8zlmmnaBu8nZ+XGo7DvwB1A21nRNpfl8Qq4TsV/C+LUJCd7 ajnZpHjcvi1GBNAsaS4ZnpxsymOEFhp3rELPhvtfnixvOcfoxmhd9YXW3sTcWjhX5xD3SjR hVSsE7u8mIUyeLgVvZfg+jyF4/KyGBRou5XZm3r/FoT8cOgJsjBPqA12I3wKRhv/OWDRi10 nggtt76P8MPp+IM1u52Mg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:jMxoRwc92RA=://izxjmlgROGCq5LSTN0n2 uZD5UFXd74Uu8dwbmO94b1VCimF+tZBXwa1wcfj7+fp5mKT+I+3nKcawOUHoz95SPBRWWuncb dNMEJ72MidKann0gBdj3wZASNsi5EMklDwY9EGpXPxVO4MdKHNdZnAG+GpGp/FtEG6wvze0NZ FzJXNxYQPluhxyr4zHVJC1fUuL8eYAkMZIGxVPrsqCLLQl4i0o5z190ZpHXK1NKtIqWkuiPma V+3mgjeT0tpVboZ/CPZvi1dOFFEMaL8OdKNS4DxphI/yx0U1vdA+He9xwS57Q40mdCqQOrzoq MU4tmvjRkf82csOl8kt3fUNqNax4e9E7UkB8pnSfcJbZHDI+cIQCOEw1Dwzlkf4/YkZeWCRZA 1HDPHouF1Em9eKFDsge5Y7DxkwPDB1elNZOBK8U8coEn7Au4nw99cXPu4oZj2VoypbEbfS7xr PN+63gY0voANmz/M7uRDksg9bXek9qpBeWiu1UP2enrmvjDOpbu7qlpjAyitsJF2BKrh+F9Kj ZCGRfmdJnTOZst0oZzrMx9nLxyDPC6Xs8RbtinUzgMBfaRBWazYmFuiXs//CfkHZueHQ5khOj UQbFbX4vpAcj6GniJVYOBqK9aGcgT44Eyg2tWVpRcLIBkDlSuY45jPEeE1vpB5psxal38OjrM 0vX8ADp1rtwqSqUTTbo896tCwib3oEL7/gqayF48UzazTJk/rtLvEdXWxQKh9fPlc0MnhzYMv ps67/5Lk3UTVXGBm5hjTHOeXtn5g1Lte/+fz+yXjD82gWsvHR7lu3rAHq1k= 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, since the init state 0xff indicates disabled. Change based on code review, not tested due to lack of hardware. Signed-off-by: Reimar Döffinger --- drivers/ata/libata-scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1fb4611f7eeb..0adea33f2137 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2981,7 +2981,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) ata_qc_set_pc_nbytes(qc); /* We may not issue DMA commands if no DMA mode is set */ - if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0) { + if (tf->protocol == ATA_PROT_DMA && !ata_dma_enabled(dev)) { fp = 1; goto invalid_fld; } @@ -3131,7 +3131,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc) u8 unmap = cdb[1] & 0x8; /* we may not issue DMA commands if no DMA mode is set */ - if (unlikely(!dev->dma_mode)) + if (unlikely(!ata_dma_enabled(dev))) goto invalid_opcode; /* From patchwork Tue Oct 12 06:27:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1539583 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 bilbo.ozlabs.org (Postfix) with ESMTP id 4HT5Ms4405z9t0k for ; Tue, 12 Oct 2021 17:28:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232690AbhJLGak (ORCPT ); Tue, 12 Oct 2021 02:30:40 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:42009 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232898AbhJLGaj (ORCPT ); Tue, 12 Oct 2021 02:30:39 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MeTwa-1n8Q5j0Nk4-00aV5n; Tue, 12 Oct 2021 08:28:15 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org, Paul Menzel Subject: [PATCH 3/6] pata_ali: fix checking of DMA state Date: Tue, 12 Oct 2021 08:27:46 +0200 Message-Id: <20211012062749.4728-4-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> References: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:AM4ZEqWrHmdnkTONhwF2ah2KZjmwINAe9w+U3HsdcQXGxbWsvlp eJoP5Jcvi0HnCMe+sJYl255OCmCkPE3BMwqE7v5Pa5QElidpu+NieDE2bMMelPFuRmWucy4 YhSIrEOp4yr4w78R+NppIzpsIuJ3rCWgF3XNOHp8nQ/FL3Hyhhf4KCTGUkO2UvUlBqOmB+t g8s1oFHyiWBP/VGLLGsmg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:2Eu+qvYesbI=:loWJ303ds0B30fSydmPxog jqR21JErVujlJp66vWz7O4HOJWoOkJIJ1WLDcU7duaGdYsvMCQ8kfntwZY0h9+CpW5VC4l/gl +Os2n89WB2pfugjPXp/tpQBKBPLd+BP9rQIJTAnuA/6TTUXZdAxNvRUc8LS7RvAIk1n9yClwy orlYX0pYseo7zIWNHyUuhhdWC788irV3qd8Fhty1HSaWnqPQdtWY8wERO6HFFbbVnF0vmrAeP Bs23cRuuEAwC9ERVsaaqBK8g7C5kcF8jSlx7BB1Cjt2KxpmsogwxpHWGbGzrQupB17CVBFfoT DWehGaCInglJmqN8pa1BiYecphT/K0Mzh5Em8n9NRHUyIj/Mya/Wpx+zpS0bXjhc4KwuyHZaM puNceQJ5gLbJoWo0BpiO+FiBQQIwzEwu4+bFnNbcq7WT/XZPql2Ag0W94xG6H8mH028VRPbko fJrXETq8aXJQlnOBCOjSHGsb1416dPDzIi7wWZ+kQmvadK57LMimUsuztgrwFYn4XwmZRitiN wBiwVqyt4KBc1moCqb9pBfcfNA3KM6Qw6fMR6yNAkaTVNk4Xv/jJRPD/iMRA8ydenvI/cJSO6 4yOWt4uarpuSBIydysvIIuvuX7HkeTW+LTVEv6pUzAuTZ6vjCydKlRfMx8t1FusIiSe5edkF8 UYEIXR82Fh7LsoQL4NUq3gFArEiqxuUyS3kfE65DnMXsP+3RlWwSv1VPCYyfm/2x+bfShOEhC jQ55t5OZN8zWnYg5Ajh9YoUFr+k1g09k/YtTVLwG6hvgmn7bKNU3YIg/QjU= 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, since the init state 0xff indicates disabled. Change based on code review, not tested due to lack of hardware. Signed-off-by: Reimar Döffinger --- drivers/ata/pata_ali.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 557ecf466102..b7ff63ed3bbb 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c @@ -215,7 +215,7 @@ static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev) struct ata_timing p; ata_timing_compute(pair, pair->pio_mode, &p, T, 1); ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT); - if (pair->dma_mode) { + if (ata_dma_enabled(pair)) { ata_timing_compute(pair, pair->dma_mode, &p, T, 1); ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT); } @@ -264,7 +264,7 @@ static void ali_set_dmamode(struct ata_port *ap, struct ata_device *adev) struct ata_timing p; ata_timing_compute(pair, pair->pio_mode, &p, T, 1); ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT); - if (pair->dma_mode) { + if (ata_dma_enabled(pair)) { ata_timing_compute(pair, pair->dma_mode, &p, T, 1); ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT); } From patchwork Tue Oct 12 06:27:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1539584 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 bilbo.ozlabs.org (Postfix) with ESMTP id 4HT5Mw1DhQz9sX3 for ; Tue, 12 Oct 2021 17:28:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232898AbhJLGao (ORCPT ); Tue, 12 Oct 2021 02:30:44 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:60679 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232941AbhJLGak (ORCPT ); Tue, 12 Oct 2021 02:30:40 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MmUDf-1n0PHl1Ip7-00iVdP; Tue, 12 Oct 2021 08:28:16 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org, Paul Menzel Subject: [PATCH 4/6] pata_amd: fix checking of DMA state Date: Tue, 12 Oct 2021 08:27:47 +0200 Message-Id: <20211012062749.4728-5-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> References: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:280TJQEtH0yKcNgrAGS4p7WhPJwlbMKkwwxDPUXGYTFNM42OPyE 4WbFgGMBTn8QSK3JhFxGcK1KkKdNUz01H7oyyE4u2Qr6lwYt/nfrNpbUPlnCkEFzW3UGrcK ElyOUgBYxyvjkk4xqfcMt1s/XyQKxP8TS/mXGrzFpU4itHKnuV+/bk+Qu3sWJ28vil7ggx/ D48GL9kuAaf/x3316mutg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1hdlr00Qdpg=:bfzWAdri14Im4JLM1bBPpe +SscsIce9/JFaVTGo61hitV1Hzd8Ri5v3uU2zQOuxSN3Y8vC1RF1HKxitgjzs/2PDYlOISpOb rUuCBKXGBN+u/jy9y3faEd1qV+IhgCgAa3ZA7+GfqRCSm1LoCx0F4sTs1YUI+2CRVL6sLl/gg 9Iaov0YciWh5CkdU5kiEQAKVc5pR0RJUE+OHp1ARdcpTkPXbKd38i5wspnul11v9DNAwnLLkQ VSR6phg5eKpvspwmXluHuj4OENAR4sfJU9EgQTRCPXT3dX6YGc1pSSdi1px47K+o5jSKQ/hbr Zjs+VIy4Eu7XO/W2RQJqkuW6x759bJRGDDqkNWzGFceYvDIZ3dt+tox1Qmsqf1BKnNLYM3nsl YueHWJQFYyIlBNlHMyicLrGVjnIAHKSLIaEuVbdwLSiCbt241DJUjVNFl66gubSQVSYYYziUn YBLITyIC/YvqX51vxBm8uRKbORdEx/KZ7LYWhEvq6eE4rjNOeR1mUXDSpIuYeBOtMxC5kQohF 1kku9Pl683SyDvA2MSq9JvRl+2Kd5Sc7+aU4e2Ys9ifumB1AYGMUfLg1wHVlw9jNDOEC3oKN7 DhLj9JkGUU8DZF3mmplOSnj/Pxqii5ldfVindvlaU7XGKiZB4A56imBubMX8Qs5qU8h1faLfb o6kZj034qsrKOAQbrUGZ+zcB6GQhUDOfkzEos+iEp+eXi8sIZnG0H/mT99O8aSnTPZJ7BQ5QU BxC5U0gUMQcNtyGSElCpP/pZHCuL61WvZOzkSc/VxxVcH1QWeGklzCADpM4= 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, since the init state 0xff indicates disabled. Change based on code review, not tested due to lack of hardware. Signed-off-by: Reimar Döffinger --- drivers/ata/pata_amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index c8acba162d02..154748cfcc79 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c @@ -66,7 +66,7 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse if (peer) { /* This may be over conservative */ - if (peer->dma_mode) { + if (ata_dma_enabled(peer)) { ata_timing_compute(peer, peer->dma_mode, &apeer, T, UT); ata_timing_merge(&apeer, &at, &at, ATA_TIMING_8BIT); } From patchwork Tue Oct 12 06:27:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1539581 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 bilbo.ozlabs.org (Postfix) with ESMTP id 4HT5Mr66YRz9sX3 for ; Tue, 12 Oct 2021 17:28:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232963AbhJLGai (ORCPT ); Tue, 12 Oct 2021 02:30:38 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:44597 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231190AbhJLGag (ORCPT ); Tue, 12 Oct 2021 02:30:36 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MYvPq-1mEEaG39tI-00UoSu; Tue, 12 Oct 2021 08:28:16 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org, Paul Menzel Subject: [PATCH 5/6] pata_optidma: fix checking of DMA state Date: Tue, 12 Oct 2021 08:27:48 +0200 Message-Id: <20211012062749.4728-6-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> References: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:b85dMji3/3R0FUsm5XLNwdcPVeCEciMnjXGP66mKoiNf5pp3C42 FZrRNXfYm779yUvasXdpTvhPoYbQE2qk1l9Yx/Vhx+PgXoIQCI1RZdrOkyGqn8/pb3MPQmn 9tcJq8xcagt5kPUmiL0nbkNR3xYC/gwguI2PsiL/KLC7Qat2d/W3U1s7cuP+zjYb6/SGZWr o0xEIDA8ARoV4/BI0IHZg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:WpEHaBy0Hbg=:302Avo+f4Ux9QNxfVs5Oy8 65cMgHsuJRLhyhpCqDJVcukj6YRid94ZBUaAz2/DiOuzyczVqx712/9UY+RnFualrmJvK4QQT HbXqPCo782c2BAQPtsQIaGCo5LfoagubArfkfxmnEDfWQvJaAW4aUEZlCyN0UkR0W8T6hwZvt OTnR2hOxj4CKbB848daC38n0xcyRRUBD7bgIerVi9IpgkSwvl+gP/I8NoZ78TCCegPBO08axL zwtpLDzy6HeJMxPgMXcPf8qP2VG75NThTnrYlXHmw7uZxQvJbN29x1GsUyalO4XK45VR64/g9 +67yfjwBeDn1B2n3RlAH28yN+55CK1lQArUh25h7XGgppVRafn/IZDlIamGizRWycgO8MJDXI IO5U5vd5pJmYfkMB3kK9gtROgME/4UAECOy+iuEf42Nuqh+CCekMsxV4gjYi/2adUXYU+YkGN zZcxf71EguvNb0rln/TWgKsyGrGDrYrEHz+KDSl7EaygU9nuVb1s6rroEuK7X5UKvf1/A11cM KBWe8D/25iWkBbeubTK09/Ntbe2slfrlF0BViW1lPTdJf9i1W702dPMY/67nd9Xq4dT8N8lym Dy8kFhA6igvuZodqAB/oLwPywmxoKHvmsIIL4q5xVAG1c49WtsilBJWwFfcdRsEmJPkmIcn8W d+0ft/n31xESM5cRarFyfl2w3KrrO9s9995iqm/2xNVDb2oTkQqD8/AkgF0nUgC7gZ8Zn6R1u 2F8DajQIa/6f36AY4UeINbd5wwDVglfwrtvqbxnGtzMp18nONtQhBDQ3jg8= 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, since the init state 0xff indicates disabled. Change based on code review, not tested due to lack of hardware. Signed-off-by: Reimar Döffinger --- drivers/ata/pata_optidma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index f6278d9de348..ad1090b90e52 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c @@ -153,7 +153,7 @@ static void optidma_mode_setup(struct ata_port *ap, struct ata_device *adev, u8 if (pair) { u8 pair_addr; /* Hardware constraint */ - if (pair->dma_mode) + if (ata_dma_enabled(pair)) pair_addr = 0; else pair_addr = addr_timing[pci_clock][pair->pio_mode - XFER_PIO_0]; @@ -301,7 +301,7 @@ static u8 optidma_make_bits43(struct ata_device *adev) }; if (!ata_dev_enabled(adev)) return 0; - if (adev->dma_mode) + if (ata_dma_enabled(adev)) return adev->dma_mode - XFER_MW_DMA_0; return bits43[adev->pio_mode - XFER_PIO_0]; } From patchwork Tue Oct 12 06:27:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 1539585 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 bilbo.ozlabs.org (Postfix) with ESMTP id 4HT5Mw3Z4sz9ssD for ; Tue, 12 Oct 2021 17:28:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232941AbhJLGao (ORCPT ); Tue, 12 Oct 2021 02:30:44 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:47857 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232995AbhJLGal (ORCPT ); Tue, 12 Oct 2021 02:30:41 -0400 Received: from localhost ([98.128.181.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MirX2-1nCq0r0sRo-00et7G; Tue, 12 Oct 2021 08:28:17 +0200 From: =?utf-8?q?Reimar_D=C3=B6ffinger?= To: Damien Le Moal , linux-ide@vger.kernel.org, Jens Axboe , hch@infradead.org, Paul Menzel Subject: [PATCH 6/6] pata_radisys: fix checking of DMA state Date: Tue, 12 Oct 2021 08:27:49 +0200 Message-Id: <20211012062749.4728-7-Reimar.Doeffinger@gmx.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> References: <20211012062749.4728-1-Reimar.Doeffinger@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:X8qz+Clvxf0Q+dZO7lAvSLA6CsYpSOp7W/xt2Pfi5BSQcqvgZSO hkpJ+TnDdUec2UsXkYK0Re4w2gh7616bbpxtXDuKVyaxRcwE9MNMYAO1nk0FiJT0kb+63ZQ u06UAxX5IC1oP+qXefYRglwK0x3FFYu/isGn7W9d+GC9tYX3S1GN5uZwgtHJqPLyGuEcCSS 9atYxyuNzVDWUrZMqPp9A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ae76cY5temw=:4fKXCIo78Kw4QBK2wDp4Ml YmnzUKDUuLQCIzfopNYrIG6R2hw4TQyfEBFkttJ3PptlgyMyXJnXGDOPUy0QIp2oO9eer4mm3 Yqd5cs2sIaXT5wy+PRAijjndfK8psRMXLMWp5pq7ViHBYgnqshuuR8SKYl9l5P3TQQc5jMbbQ 8cZ3SSynkeVShXvTUbm+vUZwXj0fKInb5Kjl/aemt6gWeNiVAcziwWr4ob2OWjUC+U+PwuIKL 9Ex6lZB8Z13SeX+C3UNC5Pd6k837DX3gcSGK48fhH2P5fpYHeFMEbKEGcl9n3qXv3oyN4T3cM R5YvHiqZqtn5vHUxM7JG+O5IQgK9aO6um/Vr32FIRwxNtIrQ9cNIqOhK4uFuj5LxX0cUMLHOn 4aCzjKOKWrGjq2ginW+sJ+W3VEwpTiSA62plMNMZSxKlxDDFPg5LK5ulKdrPlsD1Z0ymRpx2R vvnybdrBrtpfBwsx9CFegYGXfu/yyXGEUCujuUNlRNqNLHgu/m1SFdu0eb+CbcWNSEmLHWYJ1 HK293mwOF5mj43gsCvXe9Sm/uzflWvKI/HwfyyUTT+0aK3TOpH3ZHRDv+O2h6yXZdXY8mZI64 PQgYGRenjbn735wiKB5qnUsz2l/odpsIMfzs0KqWp0IXS8GBEgAHajvwras0l9Zy+aMf+9bA2 PnqHSAd1QPc/ujsPuiPG1X5Hoy8E0Fk0Wma8JP0dkivNKG6LxFLOhgpruQUNhTkCXOzCS1u8K 27I54AzVpUSFpFupPuGoCT/KdbOtCFLQQOBscaYdEfHYwCaap7LQIUWK0co= 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, since the init state 0xff indicates disabled. Change based on code review, not tested due to lack of hardware. Signed-off-by: Reimar Döffinger --- drivers/ata/pata_radisys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 8fde4a86401b..3aca8fe3fdb6 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c @@ -172,8 +172,8 @@ static unsigned int radisys_qc_issue(struct ata_queued_cmd *qc) if (adev != ap->private_data) { /* UDMA timing is not shared */ - if (adev->dma_mode < XFER_UDMA_0) { - if (adev->dma_mode) + if (adev->dma_mode < XFER_UDMA_0 || !ata_dma_enabled(adev)) { + if (ata_dma_enabled(adev)) radisys_set_dmamode(ap, adev); else if (adev->pio_mode) radisys_set_piomode(ap, adev);