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 CA1E0C282CA for ; Wed, 13 Feb 2019 18:52:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA2C320811 for ; Wed, 13 Feb 2019 18:52:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388047AbfBMSwq (ORCPT ); Wed, 13 Feb 2019 13:52:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45790 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387949AbfBMSwq (ORCPT ); Wed, 13 Feb 2019 13:52:46 -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 D3CA9C049589; Wed, 13 Feb 2019 18:52:45 +0000 (UTC) Received: from emilne (unknown [10.18.25.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1168760148; Wed, 13 Feb 2019 18:52:44 +0000 (UTC) Message-ID: Subject: Re: [PATCH 4/4] hisi_sas: 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:44 -0500 In-Reply-To: <20190213114234.67275-5-hare@suse.de> References: <20190213114234.67275-1-hare@suse.de> <20190213114234.67275-5-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.31]); Wed, 13 Feb 2019 18:52:46 +0000 (UTC) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org See comment 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 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. > > 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))) { > + 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; > }