From patchwork Thu Jul 20 04:32:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9853749 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 641FA60388 for ; Thu, 20 Jul 2017 04:33:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A1002872D for ; Thu, 20 Jul 2017 04:33:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EC5928736; Thu, 20 Jul 2017 04:33:45 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CBCF42872D for ; Thu, 20 Jul 2017 04:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kf9QQoRtFjU7V8UT85TKbCQOnvYN4bQ3Ya8oGFzgGdQ=; b=GDfpLpPRNwoDjHn5esi+LFVspj p1SlmEs0AZyiCCQUCSepztdSqDiKpyH3d4veRjfwQe6Ha9hI6oJ7bJBfCyWY2olmJKtLo2NK4Rx0v cAwzwarDY9Kh4UWK/t6uHivZ8OGHcPu9W3TiVyWwHf5cQspo0rifnRukPdCPdjH15IQ4D4yJwAUEr FJSEuzuL3oO7YQGteNooO1GCxalkkK7SX0+07wWQtPoqCJANn/En3mEALqlKRLdvS4wpStTQTIrfn 1ZusVhoxBhpXofG2nMG5Zhgwm8ptBNDPclKUD97MSB/c/NBRsIi3ag8sbDQNHhBMaBtLz1I/96YQd nCgGB+Zg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dY39g-0000Co-SY; Thu, 20 Jul 2017 04:33:40 +0000 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dY39R-0008MK-7s for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2017 04:33:27 +0000 Received: by mail-qk0-x232.google.com with SMTP id v125so8859152qkd.2 for ; Wed, 19 Jul 2017 21:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BnL4/L7FxJvh9QSQ8XWVg103B1cBmQb3sssaTGI2RdI=; b=MkzLpUoFh2hnp/l6fIrRVzCAv7y7rhcf6W7+f6CB4RS4WuzRXiMAfarlP0SJ3q1EDf H93urX7LD/C67teVu1Mozs6q+f8wVjxlfkMLY/gTM25DRl/Q4ymbwrCzxEEHQYt8dj+S B0c2AFgO9jwqdVRP39eyzyg736NfHRX5xJ6wc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BnL4/L7FxJvh9QSQ8XWVg103B1cBmQb3sssaTGI2RdI=; b=CBS878tTg01S3ZZchEDZjIrZZKG+fINQu0mywayjUxBKMC4tBeRP5pKRznkiuF4eAX aHGKg3YsZYHmKFcM+6ZoXH+i+v+oFQ7U19pNayl6BnzVUECKIBGUkvpNNg8I9g7jLByN 9vxwOLVa0zNGX8iKXnLhCo4ZAGw/qelmRuH5I8h71tp3zhkyg87gNy2htCN6IU5/AvMX eO76S3jmkLchc3PkOCdwFm62Y1tdg/IGeilks7+aK9+ohATwBVFhGAvb9oShPBjkW9PJ J31hzH74G6CsXBXSzhKyV/5VoXtwPysQUE73UfmtqLsYIhqAsX3UOHgsZev8QNuFyLQc 45Mw== X-Gm-Message-State: AIVw110S+K0uFy/k8OTQqkbMYjDbCczeotSpzODGqAPG8woAFNBAglQl VxlcvdVxT5KtChu8 X-Received: by 10.55.215.157 with SMTP id t29mr3101049qkt.187.1500525183834; Wed, 19 Jul 2017 21:33:03 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id y3sm1127252qkd.36.2017.07.19.21.32.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Jul 2017 21:33:03 -0700 (PDT) From: Anup Patel To: Will Deacon , Robin Murphy , Joerg Roedel , Baptiste Reynal , Alex Williamson Subject: [PATCH v2 1/2] vfio: Allow No-IOMMU mode without checking iommu_present() Date: Thu, 20 Jul 2017 10:02:33 +0530 Message-Id: <1500525154-5200-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500525154-5200-1-git-send-email-anup.patel@broadcom.com> References: <1500525154-5200-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170719_213325_536256_FA34A951 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Scott Branden , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Anup Patel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Not allowing No-IOMMU mode for devices already having iommu_ops on their bus is very conservative. We now have IOMMU (such as ARM SMMU) which can bypass transcations when IOMMU is not configured for a given device. In addition, it is not necessary to have all devices on bus to be upstream to an IOMMU on that bus. Due above reasons, having iommu_present() check for VFIO No-IOMMU mode is not appropriate. Signed-off-by: Anup Patel --- drivers/vfio/vfio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 330d505..9d90de7 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -124,11 +124,10 @@ struct iommu_group *vfio_iommu_group_get(struct device *dev) #ifdef CONFIG_VFIO_NOIOMMU /* * With noiommu enabled, an IOMMU group will be created for a device - * that doesn't already have one and doesn't have an iommu_ops on their - * bus. We set iommudata simply to be able to identify these groups - * as special use and for reclamation later. + * that doesn't already have one. 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; group = iommu_group_alloc();