Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4081349imu; Mon, 28 Jan 2019 17:00:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN79F/MTrFXd1qw4/b23ZPFQvgvpJPCkzPvb/r36YKe7GAX1m0+leexfwZBf2qSjjPcaW1ZQ X-Received: by 2002:a62:4181:: with SMTP id g1mr23992405pfd.45.1548723604381; Mon, 28 Jan 2019 17:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548723604; cv=none; d=google.com; s=arc-20160816; b=TxxFUzBQefEz/lWVAd4d+LuR4pkrVPvWepGugEIgdEraOOxjE1VONW1jNAyLffrUlh /HHWnHHoLH5qTrZNU9YceDY20f2ZVC3fuYacRbiYN9mrvaGHpdObasGK9wO1Pa77J5Sn I49OFph08gXsP05nOedLBWig6G49wEYRFr9V1E3tVzaK4iceFMlF3fXg9h906q4FHbIX dTPi54dR4by4JRF59XHaImYKOVHDZS1cdCmZgNwFa1KLD6fygvkZ02PTIgMVsCovx/x1 uZC5G8si6pFTxXWB4ZR/A+ghXaQ181rcPSeC8patfb/9v4QWMI+2MOpfQwd3mgpd43F9 t2Aw== 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; bh=buqTbQDILr8Ryd42mrmKHwSFQQfbxjci3nlHga8UfaQ=; b=EvfKukfA0kyQ5da7QqcuHrrQs4EECatJrRiPAI8JYOpPGWu+XKBplFiSkuSne/gk2U DOM3MEy7s8Bn3JkKIDhLt+gHkeUc2GtxjQofXHpV0SQRJ5vdJjwIwkkXnlRcCoXc3M5f DrTi9gSA7g5Y8TZCK5C4XiWO7MW7PuCKQmXKeP8AaNTRaA0I/40xf7xGUBYermsgGTty 552xbDrPasiGw10qLld7zPU5x68+zjDVhPMTl1xN90aFi7s3MOy5lhq5JFr7sl14bA/q 4jYBh/Mu6mJwiCdowHj6V4jXHgM74o84YgIOhKWBwdM54PXHCjHvXSYDQ4EqW/5kAEFA SZWw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si14911221pgv.431.2019.01.28.16.59.47; Mon, 28 Jan 2019 17:00:04 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727425AbfA2A7k (ORCPT + 99 others); Mon, 28 Jan 2019 19:59:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49334 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbfA2A7k (ORCPT ); Mon, 28 Jan 2019 19:59:40 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AC317AE95; Tue, 29 Jan 2019 00:59:40 +0000 (UTC) Received: from cantor.redhat.com (ovpn-116-77.phx2.redhat.com [10.3.116.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46C5062662; Tue, 29 Jan 2019 00:59:40 +0000 (UTC) From: Jerry Snitselaar To: iommu@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH] iommu/amd: print reason for iommu_map_page failure in map_sg Date: Mon, 28 Jan 2019 17:59:37 -0700 Message-Id: <20190129005937.32487-1-jsnitsel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 29 Jan 2019 00:59:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since there are multiple possible failures in iommu_map_page it would be useful to know which case is being hit when the error message is printed in map_sg. While here, fix up checkpatch complaint about using function name in a string instead of __func__. Cc: Joerg Roedel Signed-off-by: Jerry Snitselaar --- drivers/iommu/amd_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 87ba23a75b38..675f7027aa04 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2562,6 +2562,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, struct scatterlist *s; unsigned long address; u64 dma_mask; + int ret; domain = get_domain(dev); if (IS_ERR(domain)) @@ -2584,7 +2585,6 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, for (j = 0; j < pages; ++j) { unsigned long bus_addr, phys_addr; - int ret; bus_addr = address + s->dma_address + (j << PAGE_SHIFT); phys_addr = (sg_phys(s) & PAGE_MASK) + (j << PAGE_SHIFT); @@ -2605,8 +2605,8 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, return nelems; out_unmap: - pr_err("%s: IOMMU mapping error in map_sg (io-pages: %d)\n", - dev_name(dev), npages); + pr_err("%s: IOMMU mapping error in %s (io-pages: %d) reason: %d\n", + dev_name(dev), __func__, npages, ret); for_each_sg(sglist, s, nelems, i) { int j, pages = iommu_num_pages(sg_phys(s), s->length, PAGE_SIZE); -- 2.20.1.98.gecbdaf0899