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,URIBL_BLOCKED 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 6B8B7C282C2 for ; Wed, 13 Feb 2019 11:51:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33023222B5 for ; Wed, 13 Feb 2019 11:51:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387483AbfBMLvg (ORCPT ); Wed, 13 Feb 2019 06:51:36 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3282 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726411AbfBMLvg (ORCPT ); Wed, 13 Feb 2019 06:51:36 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0177A7E184E8E0F7C245; Wed, 13 Feb 2019 19:51:34 +0800 (CST) Received: from [127.0.0.1] (10.202.227.238) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.408.0; Wed, 13 Feb 2019 19:51:28 +0800 Subject: Re: [PATCH 4/4] hisi_sas: fix calls to dma_set_mask_and_coherent() To: Hannes Reinecke , Christoph Hellwig References: <20190213114234.67275-1-hare@suse.de> <20190213114234.67275-5-hare@suse.de> CC: "Martin K. Petersen" , James Bottomley , , "Ewan Milne" , , Hannes Reinecke From: John Garry Message-ID: Date: Wed, 13 Feb 2019 11:51:23 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190213114234.67275-5-hare@suse.de> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.238] X-CFilter-Loop: Reflected Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On 13/02/2019 11:42, 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 FC connections failing due > to corrupted data buffers, and various other SCSI/FCP I/O errors. > > Fixes: e4db40e7a1a2 ("scsi: hisi_sas: use dma_set_mask_and_coherent") > Cc: > Suggested-by: Ewan D. Milne > Signed-off-by: Hannes Reinecke > --- > drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c > index eed7fc5b3389..bc17fa0d8375 100644 > --- a/drivers/scsi/hisi_sas/hisi_sas_main.c > +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c > @@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, > struct Scsi_Host *shost; > struct hisi_hba *hisi_hba; > struct device *dev = &pdev->dev; > + int error; > > shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba)); > if (!shost) { > @@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, > if (hisi_sas_get_fw_info(hisi_hba) < 0) > goto err_out; > > - if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) && > - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { Aren't we supposed to be fixing hisi_sas_v3_probe()? We have a path for platform device probe and a path for pci device probe. You're changing the platform device probe, which is currently ok. I meant to unify all this. Now would be a good time, as it's not a fix. Can do it later. Thanks, John > + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); > + if (error) > + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); > + > + if (error) { > dev_err(dev, "No usable DMA addressing method\n"); > goto err_out; > } > From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Garry Subject: Re: [PATCH 4/4] hisi_sas: fix calls to dma_set_mask_and_coherent() Date: Wed, 13 Feb 2019 11:51:23 +0000 Message-ID: References: <20190213114234.67275-1-hare@suse.de> <20190213114234.67275-5-hare@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190213114234.67275-5-hare@suse.de> Sender: stable-owner@vger.kernel.org To: Hannes Reinecke , Christoph Hellwig Cc: "Martin K. Petersen" , James Bottomley , linux-scsi@vger.kernel.org, Ewan Milne , stable@vger.kernel.org, Hannes Reinecke List-Id: linux-scsi@vger.kernel.org On 13/02/2019 11:42, 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 FC connections failing due > to corrupted data buffers, and various other SCSI/FCP I/O errors. > > Fixes: e4db40e7a1a2 ("scsi: hisi_sas: use dma_set_mask_and_coherent") > Cc: > Suggested-by: Ewan D. Milne > Signed-off-by: Hannes Reinecke > --- > drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c > index eed7fc5b3389..bc17fa0d8375 100644 > --- a/drivers/scsi/hisi_sas/hisi_sas_main.c > +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c > @@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, > struct Scsi_Host *shost; > struct hisi_hba *hisi_hba; > struct device *dev = &pdev->dev; > + int error; > > shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba)); > if (!shost) { > @@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, > if (hisi_sas_get_fw_info(hisi_hba) < 0) > goto err_out; > > - if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) && > - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { Aren't we supposed to be fixing hisi_sas_v3_probe()? We have a path for platform device probe and a path for pci device probe. You're changing the platform device probe, which is currently ok. I meant to unify all this. Now would be a good time, as it's not a fix. Can do it later. Thanks, John > + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); > + if (error) > + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); > + > + if (error) { > dev_err(dev, "No usable DMA addressing method\n"); > goto err_out; > } >