Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1355576rwp; Thu, 13 Jul 2023 09:35:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlGrqWjbWdgMLV6WoSE5dh9+wa2qxs3ufa1fn6tWdR9ULqoMDnYcVvGYoB0P2X16P/FkpN9S X-Received: by 2002:a05:6a00:15cb:b0:682:f529:6d5d with SMTP id o11-20020a056a0015cb00b00682f5296d5dmr2012221pfu.9.1689266132792; Thu, 13 Jul 2023 09:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689266132; cv=none; d=google.com; s=arc-20160816; b=eh7Xx3NNFCLnTwq9N/DTkrRJ2aZItnI3yqAdGOfVG+u1vDdOHQiNGJIsqNzvBtEprf d8XiEiLsXSPBLMCd/mgF8MhDTxt7Ro5kXZ6Op5WbH/6nD70Q1wUX3XYMU4oLpkap25dh n0BXj63n69q3O03vmvmfogdPIiyNbpyNIJy2MLeXlkPGiX9QzZrRaG6bvY8q89X93ej/ rGdJGgB05hbxyNtZUL26qcx6EfiFKO1RHXjPgiB8a9THKc7XZALhKHcih19c98+AbRJT cDj6z6MllgHioPXfnsFWs4HUU8t3Z6raPhxVE0g8oZfyymuyVcemINmrKd0I7B48wCa+ laVQ== 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=Jh/mhCNYinfpxvG/4IDHCgfrQ64wBP0DIeI1eVValpw=; fh=QZvQxxgZ8OhfjQQEdZEvo5/2Ejx+/WqapbIgQaOwj+E=; b=drhGIvORGgIO4CJooIWx+jNwSPO7WV6CSmAGPsUnZiCF4+QK/8VcPPQ3QMMj1ueE1W qkNEjY+b6trid/YSMuws2Eu10ukcwDsqFCf3Te6BfmEuP2ggkzt3tBXmIDCG1wVSKdZj LP+qbLK+mfntoh8dssZGT1uAz9JiciORQtEPJLdZ4qni+VDE5+awbqbpK0poh4cyvssi WrGA1IisfqYhmW7pQODA/B5OINNaDM+LGQUQoUNGBYl9Rr/p1WvVy/iJPPdbDU9EIe9Q bPXqvVkhP2BuM383JZOCcPV9HoGr28lu8AeHkIo8YuglgQsPNb4jNLeOcnLSxYSjpLhE sq1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZT5Rcx9b; 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 y185-20020a6264c2000000b00681ad13f7cbsi5173174pfb.121.2023.07.13.09.35.20; Thu, 13 Jul 2023 09:35:32 -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=ZT5Rcx9b; 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 S231249AbjGMPzO (ORCPT + 99 others); Thu, 13 Jul 2023 11:55:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbjGMPzM (ORCPT ); Thu, 13 Jul 2023 11:55:12 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83C402686 for ; Thu, 13 Jul 2023 08:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689263710; x=1720799710; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HzDe1rmkDf9NDLJwnlBTzYnFxwjCcY33RbbgJLyqs1c=; b=ZT5Rcx9bzgM2HbpvI4s3iTZAbMj55EedINvDaWCVqslHMGcNut+WxFwn Cd/vAUDwcS1B872DAI5OJMXw2RpH89PdS7OGPOge+u4ajNYU1hbKir6Yk RyIMn0LXrnBnm/jij6Yrsnjxvahe2ANErTkoHflHnSxH3KMbjLF8C/Bj0 rhgrjuq/qzYJ4wyJI3xZYrSCDyZynDVY38xwdVBaHOj604EIuBWMuUR0W rXgGgDj7xdFwkyL7BZnWZ9s441lSyyUjssQqikiGTfiRxY22qd/+Z+2yd AEiHYvR64N1BrCNGOiXg+AAmAimaI6z8uOuHL1JGNV0jLhJWH2mEhzpCA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="428995541" X-IronPort-AV: E=Sophos;i="6.01,203,1684825200"; d="scan'208";a="428995541" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 08:55:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="672311580" X-IronPort-AV: E=Sophos;i="6.01,203,1684825200"; d="scan'208";a="672311580" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 08:55:09 -0700 Date: Thu, 13 Jul 2023 09:00:07 -0700 From: Jacob Pan To: "Tian, Kevin" Cc: LKML , "iommu@lists.linux.dev" , Lu Baolu , Joerg Roedel , Jean-Philippe Brucker , "Robin Murphy" , Jason Gunthorpe , Will Deacon , "Liu, Yi L" , "Yu, Fenghua" , "Luck, Tony" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v10 2/7] iommu: Move global PASID allocation from SVA to core Message-ID: <20230713090007.40ef2ac3@jacob-builder> In-Reply-To: References: <20230712163355.3177511-1-jacob.jun.pan@linux.intel.com> <20230712163355.3177511-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 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 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 Kevin, On Thu, 13 Jul 2023 07:42:01 +0000, "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, July 13, 2023 12:34 AM > > > > } > > + > > +ioasid_t iommu_alloc_global_pasid_dev(struct device *dev) > > +{ > > + int ret; > > + > > + /* max_pasids == 0 means that the device does not support > > PASID */ > > + if (!dev->iommu->max_pasids) > > + return IOMMU_PASID_INVALID; > > + > > + /* > > + * max_pasids is set up by vendor driver based on number of > > PASID bits > > + * supported but the IDA allocation is inclusive. > > + */ > > + ret = ida_alloc_range(&iommu_global_pasid_ida, > > IOMMU_FIRST_GLOBAL_PASID, > > + dev->iommu->max_pasids - 1, GFP_KERNEL); > > + return ret < 0 ? IOMMU_PASID_INVALID : ret; > > +} > > +EXPORT_SYMBOL_GPL(iommu_alloc_global_pasid_dev); > > nit. Just call it iommu_alloc_global_pasid. will do. it will be symmetric. Thanks, Jacob