Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1458925rwb; Wed, 16 Nov 2022 18:37:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf6sJncRUJAyV3I+PB0ns6OTh+cPpsicl6s8UAZzVYhTCVVnSv59/Dc3KN1D5cdl5t0qILMc X-Received: by 2002:a63:4d49:0:b0:46f:b030:7647 with SMTP id n9-20020a634d49000000b0046fb0307647mr268066pgl.13.1668652671837; Wed, 16 Nov 2022 18:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668652671; cv=none; d=google.com; s=arc-20160816; b=xBd2E28L19nnaVQFDC8DAVRioZVr6VlI3XjSAtJeeO84YDGWPUcPqVh+LiRxxowvQR rcXhCJXv+siSzni79EnNoRzQ7b0DcvQpo6GJLMhyMd4b6byl28iDDQgS8thwxxZewkbr 1KzVZIkrrEttec7CBFT/nZZM3npictjEBtUniRMfG0CKiNCGpXmp9rgU+CqoWEPAa7aN ogAZd+EPIZ4H36souGc0O6Lr/oDsiXf2JkygUlCpUcxFikfZ7Xheux1scowzcxZup8pd BGEHM1f4rutEb8dPaE0ZBAkNfToxoa91m/dT8IUkMgGNS2ivQHLjTHuMJYQE/ri2G+YS bD6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:content-language:references:to:cc:user-agent:mime-version:date :message-id:dkim-signature; bh=2Lw9SGanhg/D+tT/dGDedjrYwcofgkgqM+r/xEX86nc=; b=TkPfa6U/O/5r62ijz95bqwKy8yOwFP7Z4/DhE7KuUu4ti0QJS405809qyOxkj+wxo9 EnPqyb+3f981fqYF7dCintJSbH1g1zCvUmdS5VYfHeCvBs9SUUNFX+MvFuD2TZDckqRx kADB8HPgij7wsux0F95vc/s2C7xMwQ3qbSEypZOQoLDbmQublj5+mXecjJs0EKIwQSKY 2FEp1Paz4M5pFetllv2uAWK9xcXFoT+FlTRlAbiipkheH5ZdUHhZpYUfULRcA+mLJeO0 7SzsioC1GzWPD7mH64xaU/60JDhkqSxoggLJlvkikmPEAzPz3x3m/4r8+tiL/Y2oIygG hfaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ChmhzHvx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a170902c40400b001889ad48288si17074927plk.384.2022.11.16.18.37.40; Wed, 16 Nov 2022 18:37:51 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=ChmhzHvx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234596AbiKQBzg (ORCPT + 90 others); Wed, 16 Nov 2022 20:55:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbiKQBzd (ORCPT ); Wed, 16 Nov 2022 20:55:33 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B3AB60E8B; Wed, 16 Nov 2022 17:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668650132; x=1700186132; h=message-id:date:mime-version:cc:to:references:from: subject:in-reply-to:content-transfer-encoding; bh=uuP5q8gUlbvgaw8quTq8oqXHFLQt2Yhg3IPq6GPh/j8=; b=ChmhzHvxTU3g8tGyFOqlsWV5x056Vhppal3M6uYw/PTjuq+Av4AjCZtL +S6qxTwQZfllKvgFn7r3lGYlhtbvqrVrYKmjR9NZSoHstvoLa6CUSdsTx wnDKEUpBYzjUDP3er6DUSFSeWfCaXFM3yJS40Yl/gLB/CCVmLCodEo602 vNhoUw+ypvnhteV7DbskKZvYEcsfmRO+qtR4je4jeQ1HYrj0hOmJDB1vs R/qBJ11YNZoEoaz3DAV1cKwYj5kdAfU27L8nkGaVKm5RK9FYw9P+fMfkX WVcuTN0m9oGOBMo57+oi5nf2EqeA+yOjC5eZ9eDqf9HlzqfDLK3hNBasj g==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="300256615" X-IronPort-AV: E=Sophos;i="5.96,169,1665471600"; d="scan'208";a="300256615" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 17:55:32 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="764562079" X-IronPort-AV: E=Sophos;i="5.96,169,1665471600"; d="scan'208";a="764562079" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.210.247]) ([10.254.210.247]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 17:55:27 -0800 Message-ID: <33eea9bd-e101-4836-19e8-d4b191b78b00@linux.intel.com> Date: Thu, 17 Nov 2022 09:55:25 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: baolu.lu@linux.intel.com, Pierre Morel , linux-s390@vger.kernel.org, borntraeger@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com, linux-kernel@vger.kernel.org, Julian Ruess To: Niklas Schnelle , Matthew Rosato , Gerd Bayer , iommu@lists.linux.dev, Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Wenjia Zhang References: <20221116171656.4128212-1-schnelle@linux.ibm.com> <20221116171656.4128212-5-schnelle@linux.ibm.com> Content-Language: en-US From: Baolu Lu Subject: Re: [PATCH v2 4/7] iommu: Let iommu.strict override ops->def_domain_type In-Reply-To: <20221116171656.4128212-5-schnelle@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 2022/11/17 1:16, Niklas Schnelle wrote: > When iommu.strict=1 is set or iommu_set_dma_strict() was called we > should use IOMMU_DOMAIN_DMA irrespective of ops->def_domain_type. > > Signed-off-by: Niklas Schnelle > --- > drivers/iommu/iommu.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 65a3b3d886dc..d9bf94d198df 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1562,6 +1562,9 @@ static int iommu_get_def_domain_type(struct device *dev) > { > const struct iommu_ops *ops = dev_iommu_ops(dev); > > + if (iommu_dma_strict) > + return IOMMU_DOMAIN_DMA; If any quirky device must work in IOMMU identity mapping mode, this might introduce functional regression. At least for VT-d platforms, some devices do require IOMMU identity mapping mode for functionality. > + > if (dev_is_pci(dev) && to_pci_dev(dev)->untrusted) > return IOMMU_DOMAIN_DMA; > Best regards, baolu