Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp775545ybc; Sat, 16 Nov 2019 08:28:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxTA4ppg7LkayFCESRGNVik4m+dnABjY4Yq2pbpfXPABsc6ZCqLCsnl1aQB8pkJZqjDquhZ X-Received: by 2002:a17:907:2061:: with SMTP id qp1mr11348609ejb.43.1573921727240; Sat, 16 Nov 2019 08:28:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921727; cv=none; d=google.com; s=arc-20160816; b=Bb8myuLWbrhSoeje0mEJpWUbh7wSPoCYmYB9nqnYH1/e/DmwsIY/RLvu6pvFr9v5s/ p64VMAcMggPDQlt165jxYGbUsvf7jF4M8YbUyiWzgHF7rAZG66PxKbIWk6Bmm9ZDoFjv +KLpiQn8+b+FZHBX3NGgI8+yiXJKLA3ffzchSRGKv+8tCghd5AcA7coZ9VupjsKCTc01 +N5cg/CwdJ+2NosuuEF4hZOIpqPRFqYTdgjlUHAVL8TyfXIYIXvLqGQsLH816a2w/r+N SGW9aLn3S1iZNWF13x/0W+19ddpln7F6Ku9iSArCkappQXqpt5DyZHVj8sSYHNeex8nT W3iQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hFNg+QezcdsjBu3o6jNRgiY3zUv317hOTiaJUuZgn+M=; b=SNOnX7MDGsIlNqi+f5aZyFtSc4gNH5D3tMAXj0pSJAaLcKQ1Ig36fszt+rE0myFDjx 4YqMxAXqrGJET1LXorWPt64tO0aPsd8YdO2dy3SjJTzMkUKN7gwoieVF4afheQ7rRXhU D906/FnNmaNtWgvqfwyAg3PfwbnV1a13gLe2YGn20lctvsL3y94wXkh/l5UeGb9QwKzb NjXeouhRj1JEZUBeFOOPm0355kTl7FN25yo74u6xHa4TVNcG/+yLQ6OGWfeA5yUlA60n 0nuG7FmZ7p2xg3nLfrEnesoKgN1bQnZVvw5iRV0GaOm8rTsXJN5+I5a2yCMOZnqJJgEg g87Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iO0Fiazw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v35si8961340edm.213.2019.11.16.08.28.22; Sat, 16 Nov 2019 08:28:47 -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=iO0Fiazw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730695AbfKPQYo (ORCPT + 99 others); Sat, 16 Nov 2019 11:24:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:45914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727812AbfKPPmV (ORCPT ); Sat, 16 Nov 2019 10:42:21 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A424C2075E; Sat, 16 Nov 2019 15:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573918941; bh=qsqvoLnvkm9r6o6e3Zo90Z9m4WCmoNPo7yyWUXtRSf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iO0Fiazwy0Hg8GGtY/N6W60KGmr12j1KUKuGyL/IMkP+P7ZKzOksYajZT45VrE1SD QuJqVYg9WVMp8Y9Gt/2rONnkHYiIgtrx6lXE6sTj83NKqO8KyRs8UoI7RHOJPem3gR YpVq1G8a4BrJmzOGbF/jnYmlHb/qXCd+ByVWjxcs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , "Martin K . Petersen" , Sasha Levin , dc395x@twibble.org, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 063/237] scsi: dc395x: fix dma API usage in srb_done Date: Sat, 16 Nov 2019 10:38:18 -0500 Message-Id: <20191116154113.7417-63-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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