From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6A60C282CA for ; Wed, 13 Feb 2019 18:52:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2DD520835 for ; Wed, 13 Feb 2019 18:52:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390163AbfBMSwV (ORCPT ); Wed, 13 Feb 2019 13:52:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50116 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727340AbfBMSwV (ORCPT ); Wed, 13 Feb 2019 13:52:21 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 307AA81F35; Wed, 13 Feb 2019 18:52:21 +0000 (UTC) Received: from emilne (unknown [10.18.25.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 635A360140; Wed, 13 Feb 2019 18:52:20 +0000 (UTC) Message-ID: Subject: Re: [PATCH 2/4] hptiop: fix calls to dma_set_mask_and_coherent() From: "Ewan D. Milne" To: Hannes Reinecke , Christoph Hellwig Cc: "Martin K. Petersen" , James Bottomley , linux-scsi@vger.kernel.org, stable@vger.kernel.org, Hannes Reinecke Date: Wed, 13 Feb 2019 13:52:19 -0500 In-Reply-To: <20190213114234.67275-3-hare@suse.de> References: <20190213114234.67275-1-hare@suse.de> <20190213114234.67275-3-hare@suse.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 13 Feb 2019 18:52:21 +0000 (UTC) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch subject line is incorrect, the driver was changed to call dma_set_mask(), not dma_set_mask_and_coherent(). Also see comments below re: the patch description. The code itself looks fine. -Ewan On Wed, 2019-02-13 at 12:42 +0100, Hannes Reinecke wrote: > The change to use dma_set_mask_and_coherent() incorrectly made a second > call with the 32 bit DMA mask value when the call with the 64 bit DMA ====== > mask value succeeded. This resulted in NVMe/FC connections failing due ------------------------------------------------ > to corrupted data buffers, and various other SCSI/FCP I/O errors. ------------------------------------------------------------------- The last sentence should be removed from the patch description. And the second-to-last sentence should say something like "..the first DMA mask...". > > Fixes: 453cd3700ca3 ("scsi: hptiop: use dma_set_mask") > Cc: > Suggested-by: Ewan D. Milne > Signed-off-by: Hannes Reinecke > --- > drivers/scsi/hptiop.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c > index 3eedfd4f8f57..251c084a6ff0 100644 > --- a/drivers/scsi/hptiop.c > +++ b/drivers/scsi/hptiop.c > @@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id) > dma_addr_t start_phy; > void *start_virt; > u32 offset, i, req_size; > + int rc; > > dprintk("hptiop_probe(%p)\n", pcidev); > > @@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id) > > /* Enable 64bit DMA if possible */ > iop_ops = (struct hptiop_adapter_ops *)id->driver_data; > - if (dma_set_mask(&pcidev->dev, > - DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) || > - dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) { > + rc = dma_set_mask(&pcidev->dev, > + DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)); > + if (rc) > + rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32)); > + > + if (rc) { > printk(KERN_ERR "hptiop: fail to set dma_mask\n"); > goto disable_pci_device; > }