From patchwork Wed May 2 10:05:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10375377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A16B60384 for ; Wed, 2 May 2018 10:05:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 689F328B61 for ; Wed, 2 May 2018 10:05:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CC2428BA5; Wed, 2 May 2018 10:05:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0389E28B8D for ; Wed, 2 May 2018 10:05:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98C3F6E4E5; Wed, 2 May 2018 10:05:32 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8305E6E4E5 for ; Wed, 2 May 2018 10:05:31 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 11567323-1500050 for multiple; Wed, 02 May 2018 11:05:18 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Wed, 02 May 2018 11:05:12 +0100 From: Chris Wilson To: iommu@lists.linux-foundation.org Date: Wed, 2 May 2018 11:05:01 +0100 Message-Id: <20180502100501.28440-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Konrad Rzeszutek Wilk , intel-gfx@lists.freedesktop.org, Mike Galbraith , linux-kernel@vger.kernel.org, Christoph Hellwig , =?UTF-8?q?Christian=20K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This extends the warning suppression from commit d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set") to suppress the warnings when DMA_ATTR_NO_WARN is given by caller. In such cases the caller wants to handle the error themselves. Fixes: d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set") Cc: Christian König Cc: Mike Galbraith Cc: Konrad Rzeszutek Wilk Cc: Christoph Hellwig --- lib/swiotlb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index fece57566d45..2bfb936c5708 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -768,11 +768,14 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size, static void swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, - int do_panic) + unsigned long attrs, int do_panic) { if (swiotlb_force == SWIOTLB_NO_FORCE) return; + if (attrs & DMA_ATTR_NO_WARN) + return; + /* * Ran out of IOMMU space for this operation. This is very bad. * Unfortunately the drivers cannot handle this operation properly. @@ -823,7 +826,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, /* Oh well, have to allocate and map a bounce buffer. */ map = map_single(dev, phys, size, dir, attrs); if (map == SWIOTLB_MAP_ERROR) { - swiotlb_full(dev, size, dir, 1); + swiotlb_full(dev, size, dir, attrs, 1); return __phys_to_dma(dev, io_tlb_overflow_buffer); } @@ -959,7 +962,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, if (map == SWIOTLB_MAP_ERROR) { /* Don't panic here, we expect map_sg users to do proper error handling. */ - swiotlb_full(hwdev, sg->length, dir, 0); + swiotlb_full(hwdev, sg->length, dir, attrs, 0); attrs |= DMA_ATTR_SKIP_CPU_SYNC; swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir, attrs);