From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9C73C001E0 for ; Wed, 2 Aug 2023 20:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232531AbjHBUu6 (ORCPT ); Wed, 2 Aug 2023 16:50:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjHBUu4 (ORCPT ); Wed, 2 Aug 2023 16:50:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7255D26B0 for ; Wed, 2 Aug 2023 13:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691009455; x=1722545455; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nss3SPFs8sZFuONovQ6d4ok5xV7bZTjvxM1WKEfFBPk=; b=MdZpoQKm1hN/eY4dXJSMklxO20QAG8vQ7ufvlQKw7VNPbZnmyvkQRY1N mWC8TZa9+2fCtPEu7FtstYdQocJS8yV08oofqBHPYaK44YKVbA6HvaMS/ A4gszSdnDgxoim42S8XW5/g3aLiNcLGbCa0qtEwLDGSNlQDOg3vOhAVbJ YkvVqGZSzgl2tPLZLMw9UJsYozC/DgQrzDVH5ArLqiSFo2G1maTTFCJSO zh9Y137WiRIHB5s877lzL/ZayhWSNiL2L5VA+JvDiQq1Mz+UvlTsUpMx8 mK8OzcBWN6p+zFqqQRUvkyiVETRBh9ssvGl3aY14Xp6s8W3JLUGwU04Tk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="373335816" X-IronPort-AV: E=Sophos;i="6.01,250,1684825200"; d="scan'208";a="373335816" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 13:50:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="819370808" X-IronPort-AV: E=Sophos;i="6.01,250,1684825200"; d="scan'208";a="819370808" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 13:50:21 -0700 Date: Wed, 2 Aug 2023 13:55:29 -0700 From: Jacob Pan To: Jason Gunthorpe Cc: LKML , iommu@lists.linux.dev, Lu Baolu , Joerg Roedel , Jean-Philippe Brucker , Robin Murphy , Will Deacon , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Tony Luck , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v11 2/8] iommu: Move global PASID allocation from SVA to core Message-ID: <20230802135529.7a4ed681@jacob-builder> In-Reply-To: References: <20230724222538.3902553-1-jacob.jun.pan@linux.intel.com> <20230724222538.3902553-3-jacob.jun.pan@linux.intel.com> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason, On Wed, 2 Aug 2023 11:48:15 -0300, Jason Gunthorpe wrote: > On Mon, Jul 24, 2023 at 03:25:32PM -0700, Jacob Pan wrote: > > Global PASID can be used beyond SVA. For example, drivers that use > > Intel ENQCMD to submit work must use global PASIDs in that PASID > > is stored in a per CPU MSR. When such device need to submit work > > for in-kernel DMA with PASID, it must allocate PASIDs from the same > > global number space to avoid conflict. > > This is a bit misleading, maybe: > > == > Intel ENQCMD requires a single PASID to be shared between multiple > devices, as the PASID is stored in a single MSR register per-process > and userspace can use only that one PASID. > > This means that the PASID allocation for any ENQCMD using device driver > must always come from a shared global pool, regardless of what kind of > domain the PASID will be used with. > > Split the code for the global PASID allocator into > iommu_alloc/free_global_pasid() so that drivers can attach non-SVA > domains to PASIDs as well. > == Much better. Let me update. Thanks, Jacob