Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4734725rwl; Tue, 28 Mar 2023 10:32:44 -0700 (PDT) X-Google-Smtp-Source: AK7set/kRxw3aLbY2Xhqm7wpZPEr4rzwX17WFhrHddFSVDDxt5292AP6hDbEQ8KJzFkhh6bOLv2o X-Received: by 2002:a05:6a20:b2f:b0:dd:44a8:9d2b with SMTP id x47-20020a056a200b2f00b000dd44a89d2bmr13439417pzf.1.1680024763976; Tue, 28 Mar 2023 10:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680024763; cv=none; d=google.com; s=arc-20160816; b=FWAEDUAw5uWoJF5vFSCHyREWnr9OeBHr+zHy1n2jDgTrJhRjInHHo+4gWHsfP6E9TT 8mQg77OrVkSQc/jJc7X1PufwIdhrPwr/RkE1uAbY2uN3eEbi8uqp4LpIczWEnoigFGqj yd8MiFTymBh6SGHeebqjsiVOor+0a7ehW4p40BRrEH1SxFYjGbnsnry/mvRb+6NTRcy5 XOPgTRLhwEOFnePoMXQt9UbjmxyOTUnVlijzCY+x1qk9Wg+MnkG3zRaJRjH6pDSJ6/2E RkaDsjFbxpBuh9jO+20V9KXjhVwXEMnP0FzmC6Z3b/OJLm7+Y03+e5nuoWGQ35jIgCCh GIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=UqeLy95cIFUv6MPdBlb3OAD7faPYGdqvnGYkRVMmp+I=; b=QFcp/CgoWo8kRy1lX84MxRThpgXgZNIX1nd5ENj6RiWBuLZ4qEBhue3fmNw/JAL3q4 hiQWX0Ok4dVXorb/lYtu8PzoUtOwt5R4N5f+NtVl2iLTtw4DTzTdSe/VAW1oIBy9VXNU KLnDea7fJXmXndGQdDjC1Qv4zX8Dr1IdFc0Lb5ZZPJMm4yxjy0esDgc3uOFMKsK3fWs9 IkXhpe3ayY8rZTZ36PkbKl6ffrv3kEGSVc65h8i62Z3qzmsXYbIciaKN7JpPCLXBMLSW atZ9AIYcEv66ebF1QbkVPHK6qAp6knRmVJ0q68Z/DK1GFOYI9jMGR+CfK1vDIXiGv0de uL6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c1LlDWWV; 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 a21-20020aa794b5000000b006262531b3e2si28138721pfl.361.2023.03.28.10.32.32; Tue, 28 Mar 2023 10:32:43 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=c1LlDWWV; 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 S230421AbjC1RVt (ORCPT + 99 others); Tue, 28 Mar 2023 13:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbjC1RVr (ORCPT ); Tue, 28 Mar 2023 13:21:47 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8F21DBD7; Tue, 28 Mar 2023 10:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680024098; x=1711560098; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0TfcPjksoLAS4Lgr8pbWYVIORpk7kQ3431tuOunQDOM=; b=c1LlDWWVA7LveZDO81c2JJSKTHfs0ULzF3DqcItXafz0qlXUc3sMZ6OK NDsIusPtHlgemaW4UTVRNE/7mxM48BQ2wbZNuqPKoptum1Ji9V1ldSfxF 5oVkfdIDKFu11CE94H/Ts8f1n7oHhM8jysPDdHNi1/3oCSlQq6iOS7w/l /xfhcHBA1EdLzgl2AHLY4Q0Ussfmu+xaOOH5mzraFTZuSrhO66Syj+BRI +LjnEDkoCG+GASpvAj3L3nBDp3Kicm8uQ+8FH/99Gz2ZnLk3haVTweoom JQKjQlGqwYIZ1HdC/lNWmI4frLZzGv+fxGKMCeWmxWk54CXHR8rfjwm2C A==; X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="320289000" X-IronPort-AV: E=Sophos;i="5.98,297,1673942400"; d="scan'208";a="320289000" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2023 10:21:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="714333438" X-IronPort-AV: E=Sophos;i="5.98,297,1673942400"; d="scan'208";a="714333438" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2023 10:21:36 -0700 Date: Tue, 28 Mar 2023 10:25:40 -0700 From: Jacob Pan To: Jason Gunthorpe Cc: "Tian, Kevin" , Baolu Lu , LKML , "iommu@lists.linux.dev" , Joerg Roedel , "dmaengine@vger.kernel.org" , "vkoul@kernel.org" , Robin Murphy , Will Deacon , David Woodhouse , "Raj, Ashok" , "Liu, Yi L" , "Yu, Fenghua" , "Jiang, Dave" , "Luck, Tony" , "Zanussi, Tom" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v2 7/8] iommu: Export iommu_get_dma_domain Message-ID: <20230328102540.6158e642@jacob-builder> In-Reply-To: References: <20230327232138.1490712-1-jacob.jun.pan@linux.intel.com> <20230327232138.1490712-8-jacob.jun.pan@linux.intel.com> <20230328084822.4b46e649@jacob-builder> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE autolearn=unavailable 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 Hi Jason, On Tue, 28 Mar 2023 13:19:11 -0300, Jason Gunthorpe wrote: > On Tue, Mar 28, 2023 at 08:48:22AM -0700, Jacob Pan wrote: > > > > Agree. The kernel driver managing the device wants to get the current > > > domain of the device then iommu_get_domain_for_dev() is the right > > > interface. It knows the domain is the dma domain. > > This goes back to v1 then :) > > > > I thought the comments from v1 is that we don't want to check the domain > > type is DMA domain returned by iommu_get_domain_for_dev() > > > > If the driver "knows" the domain is dma domain, why can't it use > > iommu_get_dma_domain()? seems paradoxical. > > Huh? > > The DMA API operates on the current domain of the device, be it > IDENTITY or UNMANAGED. > > You have to copy whatever the current domain is to the PASID and you > should definately not check if it is DMA or something. > right, the PASID works for IOVA, passthrough. I misunderstood the v1 review comments. I will go back to use iommu_get_domain_for_dev() but w/o checking domain types. Thanks all, Jacob