Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3866377rwl; Mon, 27 Mar 2023 22:20:27 -0700 (PDT) X-Google-Smtp-Source: AKy350bbhNq2gp8DPFSdCk2FngyZ1aAnaQOchalcC0mQqeb0b05WKBhqJfsNv1lTPAGER/Whd5wA X-Received: by 2002:a17:903:210d:b0:1a0:53b3:ee87 with SMTP id o13-20020a170903210d00b001a053b3ee87mr10989132ple.62.1679980826851; Mon, 27 Mar 2023 22:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679980826; cv=none; d=google.com; s=arc-20160816; b=zHC4cHQQv3iE+7vG+/6dnXy3FvDOUTv3a9fbrUI4sSDay/tXFDLS55mMEzKkQvc5T5 LX1B7b3BFAkZ/HQO5zoeMnr9PSQggitURqA5dPcM2bMIG6LT98snEXIBORIDLOHK3C5H HBwVWWzAyVsiKmrT98Cg3g96yzFKrsg8g/P50wA9VnHVdobMfos2wS1TTUhnudDgHoIo zpmz4MGQY/49H2AjPHgmhGhgSqtg0nSMk6J1P4q1iFzqXViDaqc59PC/Ocbf2zFpLWxY CZbs6hRHcKJyjy+I7Jn+I3gqrhbUgn8tqgP9OXHLzqGDjaaddsS++rE9FCnpsL/rotXM zzYw== 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:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=EIkKnD9Hg3vPD960lJcqmSIyQ2Jn+qtMT1O2l9vdx0I=; b=VV63eH+6zoH4bRu859sSXvMAq0aamc0XfO3zJ79LDcQ0OdObICsMdQuadE06KD8zEY UbbRBasJcDJ+ZPC6NyTQBbd+wSDqtfC857OaobSYf1iaXDiwleVTPWbni+fBTs0KxGC8 MUkVqS+jb+Rq8YEJFt50aPDdCFP0DeZBG1XS1lGOJzzGOCU50WydksuU1HbMmY4tUMkQ R5QqexUG5gPQ+lhjh67rc/GjyvnpFdWhko78Opr4DYCbq6GsqcwPW1LSoIhyptWIeNiu fHan8WvQISDK1ih0i1QgETAR+aWTp3d7FkL4YKnBZAaCgx7FMoAMhS/JS3/zVlYIURVY xnBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GLnAKJu8; 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 m10-20020a170902c44a00b001a198422033si27733551plm.21.2023.03.27.22.20.15; Mon, 27 Mar 2023 22:20:26 -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=GLnAKJu8; 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 S230239AbjC1FUH (ORCPT + 99 others); Tue, 28 Mar 2023 01:20:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbjC1FUG (ORCPT ); Tue, 28 Mar 2023 01:20:06 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AC7619B4; Mon, 27 Mar 2023 22:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679980805; x=1711516805; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=2WDW1HbB8GiBw48W4/RWUGSXww0Cy5qMfC0++e9jU44=; b=GLnAKJu88VH2dHAeeeD+Nrwg0OmQX4qRxy6KZbVOZwtqFYIgdtBtk4gM dOfcbPfy5WjJuDx28SPjmh2+jgT16VxvEe59rI6KYUbEhCsyJ3zV+Lr8K +kwCLZYFtcHGKQ8WsqKw8XxlESMz9lr0c/TVyrC0iwFlw0hdqLCAf+c09 pscQccPt79654w5ip8k/1ASpXWWH6EMTA+iaQhbmm0cwssNWH5KMx8kiR ivkc6RwV74iywg7kqRdJtQcDbj89yGabxqOcPB6D0GLvUIst39qe+SbGt zQRyFRMQLC30hWn2wE1/wisG2QAtJDW93ZvJdhhkD05Rp+x6ORzTR0210 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="403082808" X-IronPort-AV: E=Sophos;i="5.98,296,1673942400"; d="scan'208";a="403082808" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 22:20:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="633887906" X-IronPort-AV: E=Sophos;i="5.98,296,1673942400"; d="scan'208";a="633887906" Received: from allen-box.sh.intel.com (HELO [10.239.159.48]) ([10.239.159.48]) by orsmga003.jf.intel.com with ESMTP; 27 Mar 2023 22:20:00 -0700 Message-ID: <41d31adf-577e-431c-c400-2708885400c1@linux.intel.com> Date: Tue, 28 Mar 2023 13:20:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Cc: baolu.lu@linux.intel.com, Robin Murphy , Will Deacon , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" Subject: Re: [PATCH v2 4/8] iommu/vt-d: Reserve RID_PASID from global SVA PASID space Content-Language: en-US To: Jacob Pan , LKML , iommu@lists.linux.dev, Jason Gunthorpe , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org References: <20230327232138.1490712-1-jacob.jun.pan@linux.intel.com> <20230327232138.1490712-5-jacob.jun.pan@linux.intel.com> From: Baolu Lu In-Reply-To: <20230327232138.1490712-5-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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,NICE_REPLY_A,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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 On 3/28/23 7:21 AM, Jacob Pan wrote: > On VT-d platforms, RID_PASID is used for DMA request without PASID. We > should not treat RID_PASID special instead let it be allocated from the > global SVA PASID number space. It's same to AMD and ARM SMMUv3, right? They also need an explicit reservation of PASID 0. > > Consequently, for devices also do DMA with PASID, drivers will not worry > about conflicts when it comes to allocating PASIDs for in-kernel DMA. > > Signed-off-by: Jacob Pan > --- > drivers/iommu/intel/iommu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index 9f737ef55463..61c06f7ad8f7 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -3956,6 +3956,10 @@ int __init intel_iommu_init(void) > > intel_iommu_enabled = 1; > > +#ifdef CONFIG_INTEL_IOMMU_SVM Do we really need this #ifdef? IOMMU_SVA is selected by INTEL_IOMMU_SVM, right? So if CONFIG_INTEL_IOMMU_SVM is not set, iommu_sva_reserve_pasid() is just a dumb. > + /* Reserved RID_PASID from the global namespace for legacy DMA */ > + iommu_sva_reserve_pasid(PASID_RID2PASID, PASID_RID2PASID); > +#endif > return 0; > > out_free_dmar: Best regards, baolu