Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5988503ybc; Wed, 27 Nov 2019 12:59:45 -0800 (PST) X-Google-Smtp-Source: APXvYqwXw+IaWUwBIFH3YGRYN4bix9i35Kpuv0GiFXjNtj/5rv2N4RI+0yUso0tKTDQpw0PgkrGW X-Received: by 2002:a17:906:958b:: with SMTP id r11mr51687044ejx.332.1574888385023; Wed, 27 Nov 2019 12:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888385; cv=none; d=google.com; s=arc-20160816; b=EFSEqqq2cheZJiUDpX8/PXUIAq+xWf0KCfRYViT5TJGRK7/0WxiZaet4LBb+TDnOXX A6Lr6FLT+Wl0/y3E15AZof3CV2oP2jW0DkMrOJ1cCm8dHcaHaB216JzgmbLnYZIAbt8w W6nS8LKa9FXhWHUaFoV8Vh4bAHoXfRNHS1fcMnmHW7PNxugUrzsUig4t1Tx/0sFvfGwN vwTdNDq9yvz5z4uUhG+9UopARE9tcMAAF85Z8a7u71pkvOE1bMy5gMZ+v+HPgQ9s2Jca 2WZEDQ67DtvaRMKx0MDayIBkGg57gHkjPBjm/u7nvECJrr2r/0WYfQZM24KF8wdskgYC i+nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hFNg+QezcdsjBu3o6jNRgiY3zUv317hOTiaJUuZgn+M=; b=ulJ0vNW1TJeMZ+2M5IrG4DLjiTPzFn6Rb+fedNre0wDeGFkRJJrnH4xvSakMK40n4B MZh1U68A28sRplCtxwy8wj7ZtoGxg/hUtFIHAUIA9Cod65hY+6PUuH9fQ0EWAQ7N8gzh oEr2ljDrWKhH2sJJtYYVTCK6/ONtm1INUpUiRQsvsLtrX1uTuq1n2ExaVUkOsYndnjGO wix5Ca2khT+MG4v7nCuum3PES31c36I6qv3F/39RYBdB9d1curcoq2ciEAH8VRs+M1d5 JefT4/ODtX1aZoxBUjKm+wE+q7X+Fr6ZaVrCX8lSG4ZXmjl+YoOIuUvkh/yB0g8rEsnT mlwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M3XJGZRJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si9880313eji.232.2019.11.27.12.59.21; Wed, 27 Nov 2019 12:59:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M3XJGZRJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731324AbfK0U63 (ORCPT + 99 others); Wed, 27 Nov 2019 15:58:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:49742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731319AbfK0U61 (ORCPT ); Wed, 27 Nov 2019 15:58:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37E3421582; Wed, 27 Nov 2019 20:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888305; bh=qsqvoLnvkm9r6o6e3Zo90Z9m4WCmoNPo7yyWUXtRSf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3XJGZRJtsUfSmTOZznEFI/PNwGlQaQqwbrqSPRSvDvmYrK7CwIQyjROA6ZAyEfjI jPHiOGKEZ0CHF50T7EAQd8hD9MP6UkySxqsueMF2NPbGktxK9ucadEQIECcf8ZOaM1 9TYAnbMDdx1XdkKTFFeq2Nml2EqAWzNgPZejUMQ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 082/306] scsi: dc395x: fix dma API usage in srb_done Date: Wed, 27 Nov 2019 21:28:52 +0100 Message-Id: <20191127203120.921093907@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit 3a5bd7021184dec2946f2a4d7a8943f8a5713e52 ] We can't just transfer ownership to the CPU and then unmap, as this will break with swiotlb. Instead unmap the command and sense buffer a little earlier in the I/O completion handler and get rid of the pci_dma_sync_sg_for_cpu call entirely. Signed-off-by: Christoph Hellwig Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/dc395x.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 1ed2cd82129d2..08161df64ead5 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -3447,14 +3447,12 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, } } - if (dir != PCI_DMA_NONE && scsi_sg_count(cmd)) - pci_dma_sync_sg_for_cpu(acb->dev, scsi_sglist(cmd), - scsi_sg_count(cmd), dir); - ckc_only = 0; /* Check Error Conditions */ ckc_e: + pci_unmap_srb(acb, srb); + if (cmd->cmnd[0] == INQUIRY) { unsigned char *base = NULL; struct ScsiInqData *ptr; @@ -3507,7 +3505,6 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, cmd, cmd->result); srb_free_insert(acb, srb); } - pci_unmap_srb(acb, srb); cmd->scsi_done(cmd); waiting_process_next(acb); -- 2.20.1