Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp120695ioo; Fri, 20 May 2022 15:47:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEI01RFOBtcpTxgFKS5lnCH+2mDZcV7yDVySijYxCPYPLVZMXUQQKXAGhBeLLja0Y1DqCF X-Received: by 2002:a17:907:215b:b0:6f4:d91c:ef53 with SMTP id rk27-20020a170907215b00b006f4d91cef53mr10243199ejb.175.1653086845158; Fri, 20 May 2022 15:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653086845; cv=none; d=google.com; s=arc-20160816; b=lg36L03hCIPurvm8COjS/ck8OjaeIKbqT0Y6vnKv7FbLwgvplKFb0DB6fTpTf9HIn+ 3JggugUUQeumIa83rM/IzhLgoS0rlfAbCJeY3cN1PXjbBAFlTRudDW04K0jHUpGT4gdx RBJgg4+CqddmNQWPdjf0oTLcdvWwHUdW80HpKWbyKIY7ebnKPziWjdfjbN79BCaarfW/ +Up8fy6662MEqXUb2HBmbRsQKTRl6TtZ6Jkds1s576YtSYXTirJSsQAzUlZAiwRf5X9F BqPPaWjLDV/G93qXJtOO7QhaVIwmKN8QXdImC/eI/oFhULWApbzsLYj+/K5/tryRZs2+ rKnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=B4edNZMPA/EmDWW0x6yeiymWcE4oMT37uXeGsDrFti4=; b=kPE8uIR94ja1usfZWwyvFGnaXjgNslQOjiHsM3pM7r07N4XkeOsTy+wyPGvtarRhaM IgSvLvhHQTgPj15yGjSJCkfEmAw4phPSk6Jd0rxTGiOBsabIkrD32C3DhwN3SE1zF2Ey TK9szrmq0Hdi7FLLI/bHEMCGJvbtg7DqTrhX+CW3a8PvIWCMXDencegs5M24At0nEaCJ 1rsSbpGyxCv8M7VnxfMu9EnnAZnCMYWNwFSUn7KYqlKo4ECatiPqnwsXcO1oMgYEitBj l090qmlJPDjVMzl2A4/4qqi9w1oFK9j56a4vBFifG0GVzj9A0sG+WMvg6HubXtaNaA9j bRcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp4-20020a170906c14400b006df76385bbasi7068750ejc.90.2022.05.20.15.46.58; Fri, 20 May 2022 15:47:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347272AbiETIpg (ORCPT + 99 others); Fri, 20 May 2022 04:45:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345445AbiETIpc (ORCPT ); Fri, 20 May 2022 04:45:32 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E598F9E9EB for ; Fri, 20 May 2022 01:45:30 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id C6EE91E9; Fri, 20 May 2022 10:45:28 +0200 (CEST) Date: Fri, 20 May 2022 10:45:27 +0200 From: Joerg Roedel To: Lu Baolu Cc: Jason Gunthorpe , Christoph Hellwig , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Eric Auger , Liu Yi L , Jacob jun Pan , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] iommu: Add blocking_domain_ops field in iommu_ops Message-ID: References: <20220516015759.2952771-1-baolu.lu@linux.intel.com> <20220516015759.2952771-3-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220516015759.2952771-3-baolu.lu@linux.intel.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 16, 2022 at 09:57:56AM +0800, Lu Baolu wrote: > const struct iommu_domain_ops *default_domain_ops; > + const struct iommu_domain_ops *blocking_domain_ops; I don't understand why extra domain-ops are needed for this. I think it would be more straight-forward to implement allocation of IOMMU_DOMAIN_BLOCKED domains in each driver and let the details be handled in the set_dev() call-back. The IOMMU driver can make sure DMA is blocked for a device when it encounters a IOMMU_DOMAIN_BLOCKED domain. For IOMMUs that have no explicit way to block DMA could just use an unmanaged domain with an empty page-table. Regards, Joerg