From patchwork Fri Feb 9 15:16:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10209595 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 4FE2260247 for ; Fri, 9 Feb 2018 17:43:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E2332970D for ; Fri, 9 Feb 2018 17:43:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3290F29798; Fri, 9 Feb 2018 17:43:31 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3A122970D for ; Fri, 9 Feb 2018 17:43:30 +0000 (UTC) Received: from localhost ([::1]:49475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekCht-0006EL-Tg for patchwork-qemu-devel@patchwork.kernel.org; Fri, 09 Feb 2018 12:43:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekAQO-0003tA-IK for qemu-devel@nongnu.org; Fri, 09 Feb 2018 10:17:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekAQK-0003FV-Jq for qemu-devel@nongnu.org; Fri, 09 Feb 2018 10:17:16 -0500 Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]:44872) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekAQK-0003En-Bg for qemu-devel@nongnu.org; Fri, 09 Feb 2018 10:17:12 -0500 Received: from ayla.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id 8fH71x02P3XaVaC01fH7HZ; Fri, 09 Feb 2018 16:17:09 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1ekAQF-0003RE-DL; Fri, 09 Feb 2018 16:17:07 +0100 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1ekAQF-0000jY-8Z; Fri, 09 Feb 2018 16:17:07 +0100 From: Geert Uytterhoeven To: Baptiste Reynal , Alex Williamson Date: Fri, 9 Feb 2018 16:16:49 +0100 Message-Id: <1518189413-2761-3-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518189413-2761-1-git-send-email-geert+renesas@glider.be> References: <1518189413-2761-1-git-send-email-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:13 X-Mailman-Approved-At: Fri, 09 Feb 2018 12:38:16 -0500 Subject: [Qemu-devel] [PATCH/RFC 2/6] vfio: Ignore real IOMMUs if CONFIG_VFIO_NOIOMMU=y X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , kvm@vger.kernel.org, Magnus Damm , Alexander Graf , qemu-devel@nongnu.org, linux-renesas-soc@vger.kernel.org, Wolfram Sang , Laurent Pinchart , Geert Uytterhoeven Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allow use of the No-IOMMU mode even if a real IOMMU is present. This is useful in case the device is not part of an actual IOMMU group. Not-Signed-off-by: Geert Uytterhoeven --- Question: - Some devices (e.g. rcar-gpio) don't use DMA, so why do they need an IOMMU group? - Even devices using DMA may do so using a separate DMAC module, pointed to by "dmas" DT properties (e.g. sh-sci), hence they may be not part of an IOMMU group. - How to know which devices do DMA? --- drivers/vfio/vfio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 2bc3705a99bd2f1a..7736c3fbe468a3da 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -129,9 +129,13 @@ struct iommu_group *vfio_iommu_group_get(struct device *dev) * bus. We set iommudata simply to be able to identify these groups * as special use and for reclamation later. */ - if (group || !noiommu || iommu_present(dev->bus)) + if (group || !noiommu) return group; + if (iommu_present(dev->bus)) + dev_warn(dev, "iommu present (%ps), ignoring\n", + dev->bus->iommu_ops); + group = iommu_group_alloc(); if (IS_ERR(group)) return NULL;