Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4521944rwd; Tue, 23 May 2023 08:45:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JdaQsehcScjjhFTBQfQMfIy/d6Ra1sUggRLUcQyymKTxGMFmFPVphtnGHJqbwYtJGwWOW X-Received: by 2002:a05:6a20:8f05:b0:10c:49e:6c67 with SMTP id b5-20020a056a208f0500b0010c049e6c67mr5712385pzk.33.1684856758947; Tue, 23 May 2023 08:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684856758; cv=none; d=google.com; s=arc-20160816; b=C8Yhtrpk2mw2S2zkz2QM554Wn07+7FS7aedasLlwLJ9d/k3NjhRZZjxHXekBWCKfBn oPzQlC0qzPWae0+zs+5RHKRfpMrYyidOuqnEWGSUicJRwoqBqvGWU5MNK8kCCg7BN+1T liyi5+YZbx+wImFS0w3iMN8FKbgwoeEBNwvinWTGHvlah8n809dibinQg5RgBMGZGPne WPIv+j7I83b4Hw1nNscYXPB+Sf766ltCi81i8/oYa3O1fF8QMOJ6rMwkojYnnkS2MUpV YuyeMQAxt5IBrIdTRAs/IulLALoeLJjFbdaz0qAuB1RQ63RnJ3gduu2RSNJAB2MfoM62 ROyQ== 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=C29ZjSh11G5XB9E2OBHwJ5h/qX+yxqNnvhhQw8Fmni8=; b=q/2/pQRk0XVfoDI5ppqefPi1rHsy028sE2Ct7ySQSMgTkesTXLu4KRO2yoGoOZ47W1 FwFM8htVF3LlWuYTPPUp9FBtk2qRx85AqAZ40KuwR3X5OTXF2y1VyGTztLhlwpW3Y98p IGww+6QsmEl/rkuvg91y0HFm+CTtTAsDA2ACGNP8RHwJVIQCYjX+V9OicbG2oY6UD1/9 88rWHXuZN3cdsTKAif9jOo/dy47uED7owLX7M1D6cHeSPkhBu369SWZ5CW3oam6n7Xs7 OLQvU4rbLj25mNdVqQ+iMzcDmXJJGGn9sTx4pFvD5LjL6ZKH8sYzrKoUQ003UyVc5yCf AM4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jESjFSSP; 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 y18-20020a63b512000000b0052cad19f77dsi6604948pge.0.2023.05.23.08.45.45; Tue, 23 May 2023 08:45:58 -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=jESjFSSP; 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 S235471AbjEWPV4 (ORCPT + 99 others); Tue, 23 May 2023 11:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235751AbjEWPVw (ORCPT ); Tue, 23 May 2023 11:21:52 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B30FA; Tue, 23 May 2023 08:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684855310; x=1716391310; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mZESLGiStlp+snnZO6mgcThSkiz1+FlRkX0Y1V4e3SE=; b=jESjFSSPx+8+8j5Xhi+bu2/IIbbn6XUjx/+sm/7mBocX7VIjBMOpxkm4 xkuDnSwOj1mAi/C+RjTkHZbKaEGNGtj/nd+YxFG3R9BOBMvSj0xqWkzP/ niDM08MD772j8toc1x0P+BoL1IfS1rBtqUszuxQ5gyeNL0Hhx5u8a1Zzq Vsk5keIUSAQ5YBDKPX2MuYh75PR8MmG6r032bGge71ew2QIJyFA2Dfp+o GICdYXTZkvD4YnXt7C4uFteFenRVCStw2rMoMhURLNAZ/5Wvi/BuBNb4N eqAkKBnYNJJcxh6iX4OofskIgddTjr6W6lM9kpXCC4Hnnsuameo9tv58z A==; X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="353295747" X-IronPort-AV: E=Sophos;i="6.00,186,1681196400"; d="scan'208";a="353295747" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 08:21:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="950584434" X-IronPort-AV: E=Sophos;i="6.00,186,1681196400"; d="scan'208";a="950584434" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 08:21:49 -0700 Date: Tue, 23 May 2023 08:26:21 -0700 From: Jacob Pan To: Jean-Philippe Brucker Cc: LKML , iommu@lists.linux.dev, Jason Gunthorpe , Lu Baolu , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org, Robin Murphy , Will Deacon , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , narayan.ranganathan@intel.com, jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v6 1/4] iommu: Generalize default PCIe requester ID PASID Message-ID: <20230523082621.51f103cc@jacob-builder> In-Reply-To: <20230523144733.GA4137946@myrica> References: <20230519203223.2777255-1-jacob.jun.pan@linux.intel.com> <20230519203223.2777255-2-jacob.jun.pan@linux.intel.com> <20230523144733.GA4137946@myrica> 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=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Hi Jean, On Tue, 23 May 2023 15:47:33 +0100, Jean-Philippe Brucker wrote: > Hi Jacob, > > On Fri, May 19, 2023 at 01:32:20PM -0700, Jacob Pan wrote: > > PCIe Process address space ID (PASID) is used to tag DMA traffic, it > > provides finer grained isolation than requester ID (RID). > > > > For each RID, 0 is as a special PASID for the legacy DMA (without > > PASID), thus RID_PASID. This is universal across all architectures, > > therefore warranted to be declared in the common header. > > Noting that VT-d could support none-zero RID_PASID, but currently not > > used. > > > > By having a common RID_PASID, we can avoid conflicts between different > > use cases in the generic code. e.g. SVA and DMA API with PASIDs. > > > > Signed-off-by: Jacob Pan > > --- > > v6: > > - let SMMU code use the common RID_PASID macro > > --- > > .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +- > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++++---- > > drivers/iommu/intel/iommu.c | 24 +++++++++---------- > > drivers/iommu/intel/pasid.c | 2 +- > > drivers/iommu/intel/pasid.h | 1 - > > include/linux/iommu.h | 1 + > > 6 files changed, 20 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c > > b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c index > > a5a63b1c947e..160b31e6239d 100644 --- > > a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +++ > > b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c @@ -80,7 +80,7 @@ > > arm_smmu_share_asid(struct mm_struct *mm, u16 asid) > > * be some overlap between use of both ASIDs, until we > > invalidate the > > * TLB. > > */ > > - arm_smmu_write_ctx_desc(smmu_domain, 0, cd); > > + arm_smmu_write_ctx_desc(smmu_domain, IOMMU_DEF_RID_PASID, cd); > > > > I agree with reserving 0 globally for non-PASID DMA, but could we call > this something more generic, like IOMMU_NO_PASID? The term "RID_PASID" is > specific to VT-d and "RID" to PCI, so it looks confusing here (this driver > also supports non-PCI). "NO_PASID" would be clearer to someone just trying > to follow this driver code. > Sounds good, it is for DMA w/o PASID. Thanks, Jacob