Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp38421rwr; Thu, 4 May 2023 14:29:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bSpi3EMrKI14SDKZzvjG7IWSgThIuJX1iAVSZP4mfSzB8dz2tv9T44+FKZdwKXWUu0wCc X-Received: by 2002:a17:902:da91:b0:1a6:81ac:c34d with SMTP id j17-20020a170902da9100b001a681acc34dmr5464756plx.28.1683235770185; Thu, 04 May 2023 14:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683235770; cv=none; d=google.com; s=arc-20160816; b=XgfST2iuN3X3HyHm5YFPOLTSM6yR65rzoEFY7xEk7Kkhik9bAwJrA2txCDhJ0FhYi7 czhrExmS2MKLqJ897dG8L0L/8ZPvaxd61lTMKdKnzUkpduSVhFpwKLc4a+xBqZA7MGpm M7QAauwn8/g23ROqFYJ0X8D0vuc3bmyvN9EZEzN6wGLUSjqaTNAHyt0p50M2ptV0QlW4 TJlzPL2Aw6A+lm8THtmw8VtQ1mqCpZ3PnAXOLMSPbi/7zisZUeOL8eqhlTHrZwGSOYVb Hcfk+Se4o0HDc8Cs8U3fSzXxfrO76X3hjJMeBrhd6bpz6Y0DPYMCSh8ewMPAJXT70Qqp FsbQ== 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=4m/hocwlBPAL3vG6hIBX+8ulcmndjkiXuP9s47DO/RI=; b=KyjYKw/3vuL3lLb3hZM5xSCBXDTMPDO78/oTbs+BxCLVQJRFbWC4+51TuoWOf7HAKE J+ySLpgNaf1mtzZd+metyeo/6UaWIaAi7YXNeeuLgcN2IK7N+07KlUpC03FEDg9NOaej jsiiLodj4mH8w7iZlMqFb1QuRU2u8PhqFDqcxfeGX08e7EkAGkwi1idJidI2IbbED/hV 7gclrrKsRiz3EIGt3p6FCMN+S2LwFxQD+dmuvwMYjvn4z1xwhFslRoqSBU6H8e2oAAUu IM3ObORkTB/JC/yixejrAPJkyCMi8u1s9kiPTTYJWUB4f4RRcZHn2S+FUWuMP8yHzXmb LM9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KerhoHOW; 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 bc8-20020a170902930800b001a229e52c19si28890plb.91.2023.05.04.14.29.11; Thu, 04 May 2023 14:29:30 -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=KerhoHOW; 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 S229739AbjEDVWO (ORCPT + 99 others); Thu, 4 May 2023 17:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjEDVWM (ORCPT ); Thu, 4 May 2023 17:22:12 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFE5F13C09; Thu, 4 May 2023 14:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683235331; x=1714771331; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yoXBNYJ/UPota7gNEgZ5BSyK4zH3Zyhjtbi1BVTh/7U=; b=KerhoHOWGSAf9tVtgwsSR4Frkg0W5jeyD9NLs9QXS4B/Dul0xy+1hdW3 nMWEn1WrylgtprGu/kD2lvGx1K/urv4zTyUdTMCfz/3h1u78vLDE41Bcw 5HjKMjQ7moXm94VGGB9ogwuo+USnlEzMJ0a35+KM2lO+GO8lgGrDZmAeu SseUbxQZEGOyZtorGJEb7DGribfQSIMh4jjrWhGrxdjCNW+X5RR6LzuTg vaXC7T2j3DsY7CDK38q3Ny9MOJmpMD8FZPK1yaVj+inEiai62kEyFPTiP NCucJnT4oYABu2QjfwByVV7KZmDb+HocyAP4lL88JvTxJZ0+RVIC6+g3h A==; X-IronPort-AV: E=McAfee;i="6600,9927,10700"; a="435378030" X-IronPort-AV: E=Sophos;i="5.99,250,1677571200"; d="scan'208";a="435378030" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2023 14:22:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10700"; a="762115908" X-IronPort-AV: E=Sophos;i="5.99,250,1677571200"; d="scan'208";a="762115908" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2023 14:22:10 -0700 Date: Thu, 4 May 2023 14:26:33 -0700 From: Jacob Pan To: Baolu Lu Cc: LKML , iommu@lists.linux.dev, Robin Murphy , Jason Gunthorpe , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org, 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 v5 3/7] iommu: Move global PASID allocation from SVA to core Message-ID: <20230504142633.1a7e78ae@jacob-builder> In-Reply-To: References: <20230427174937.471668-1-jacob.jun.pan@linux.intel.com> <20230427174937.471668-4-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.5 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 Baolu, On Wed, 3 May 2023 14:32:15 +0800, Baolu Lu wrote: > On 4/28/23 1:49 AM, Jacob Pan wrote: > > +ioasid_t iommu_alloc_global_pasid_dev(struct device *dev) > > +{ > > + int ret; > > + ioasid_t max; > > + > > + max = dev_iommu_get_max_pasids(dev); > > Perhaps you can use dev->iommu->max_pasids. It's static, so no need to > recalculate it. > sounds good! Thanks, Jacob