Received: by 10.192.165.148 with SMTP id m20csp445558imm; Wed, 2 May 2018 03:07:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrMbQokoeNZT99A5C2XgYJuH/PIgMZywkwWQQ6AppSkP7wu99vZC12LVmZLOE4lq6p3iXYO X-Received: by 2002:a63:aa01:: with SMTP id e1-v6mr15553494pgf.331.1525255657622; Wed, 02 May 2018 03:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525255657; cv=none; d=google.com; s=arc-20160816; b=dUp3D6d853noI/DtDgEnnroW2LwsvPw7Z1Ntt01QImghQ1suzhr+iYsh2A75WMzmuB bf6nofrI8xb0fCE9VdkKfoeKpfBL1gFgMiz7eBn6iEKD/neJ53A4FW7bFPSo3lyNYdZf VBjmnQtq6X09rA57N/GZwMbgassBWvueuFYlVtaYwQM6i4RN2aYYTtNAHOTOhopjrEK/ E6rtycwnJTQ4ST60XBLtNKMXzsaToC3MQOg51rMfDHidxwyd4vcxmUyXe4MOAUx0hK6P DaVdU45pMlDVVm2uLO6l+hl9jcckwfd+yDvjosJxAYTPuxLefKjIo9xQb2ryu1XT1fHr fAbw== 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 :message-id:date:subject:cc:to:from:arc-authentication-results; bh=MJs9AspxUNfRRb024ENXdXGK8IF3F3+XbhYo2uDlPXM=; b=TTs2w7BZg6gWgGKzx48trmG7XJIOy4TSflMlhEs1Y9tagyNTe7R69lnEN/Ynz1sQfi c484njkfovk/S24oDaOHAgrlX10+eaECW3EfxkgA2qTeGBYN/g2Bc+uwmlNngxHMiDlA LPHEci/j2U9/wGleCaeKE5efGF3rAB7Q8xUb4iKUHmF+KlQ1IYPjHJV48TiZW1o3nh0D +6J/4tBN4Vjzl6DjkVxDAS8/KSIrNhUbkTnSZyxUg/1qbdTBYPbG21PYlfACswoNrVRg RxmihDJDhfkFWbHzs1VRwdXLSlCiyMZ6lEvjJXZayrIC8RJHDKGtmGx5q24QqwdJ+Qaq 8/8A== ARC-Authentication-Results: i=1; mx.google.com; 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 r6si11130856pfi.147.2018.05.02.03.07.22; Wed, 02 May 2018 03:07:37 -0700 (PDT) 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; 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 S1751477AbeEBKFf (ORCPT + 99 others); Wed, 2 May 2018 06:05:35 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:55402 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750932AbeEBKFd (ORCPT ); Wed, 2 May 2018 06:05:33 -0400 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 Cc: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Chris Wilson , =?UTF-8?q?Christian=20K=C3=B6nig?= , Mike Galbraith , Konrad Rzeszutek Wilk , Christoph Hellwig Subject: [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.17.0