Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1509196pxb; Wed, 30 Mar 2022 05:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJJ5EBhyJwC/Zh1QQB73bSCBMrDgqi83mQ+7uOJyrA/q/HDi4b44m2MAVXtiYMoMyl70RS X-Received: by 2002:a50:cddc:0:b0:418:d6b8:7f9a with SMTP id h28-20020a50cddc000000b00418d6b87f9amr10173867edj.141.1648642680003; Wed, 30 Mar 2022 05:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648642679; cv=none; d=google.com; s=arc-20160816; b=uFFE2I/Qrfc+bPAjpLTMRfqCXzE2G9flLFBsIPNndtnLhSGgRb94AFvdlOa6y1ir4e k9BAQZblnYin+XEtF308Y84NlSuKSrvmDEHpnLJKymsX+eGZKMoK6pkUlLFtAIxM+JY3 zQhL6PSZqR+JwR7CruybqbSkcWiS0pPH5Ziia22daY9Zqk6tnVVeSSMb52AkQDspIe1A iZ0zeMYZgJ4CUahG3o9/6SrHFOgzb5IB4MnTEO6fLtyO22G0uKbaDK4xzigCH9m/WZQK t6kVsATg6HG6VGmBIRjqCuNxpgv7+YgvmgQBXC69n70ihvOYkonI/fEQA5e4lLPmAk9s Op/Q== 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:subject :from:references:to:content-language:cc:user-agent:mime-version:date :message-id:dkim-signature; bh=HbSrluNPTtNNhy7WbJTw6CbV4I8MdSClHDN+73vDOOg=; b=Fhzd2t3+Yujiz8jIAY0/u0ZkQ9BUi+nwuNvZkTfOJc7orD8YCPudPYH4kN/pqWk7zV 4UWIywMjN/wxuBLS7mxz5ckZxjs9J3ZisscnPMMVMNp81aTlw+vRAJhjYONdoOB07LQv C00OK6XnYvfzs3DQNT7PvoU6O79ZRdpQh4wKk/rZZ2tx2ohpePzk4IhQ/oXJ8Yy0b+BX /9j1Sxc7X+M777fxqFMKHUn8+3l5ZCdXMbCpqddrs7drES2kXGQusiMWrQsTlIUjvUHz LglmwMJhTmeZR6RZrWKltu3kWiOUbwFW/7azNT60rzxi8vImEilJco4ndUGdm7U7v65n pidw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VHcvtfKy; 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 l4-20020a170907914400b006df76385c56si15913402ejs.246.2022.03.30.05.17.30; Wed, 30 Mar 2022 05:17:59 -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=VHcvtfKy; 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 S242569AbiC3EcI (ORCPT + 99 others); Wed, 30 Mar 2022 00:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242564AbiC3EcG (ORCPT ); Wed, 30 Mar 2022 00:32:06 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CBF19298 for ; Tue, 29 Mar 2022 21:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648614622; x=1680150622; h=message-id:date:mime-version:cc:to:references:from: subject:in-reply-to:content-transfer-encoding; bh=ymV54KbkzNGiX0mm/3VkYQ0yuZNW6n8dT6h/b4tupgE=; b=VHcvtfKysrfck03zdqYQd/7Zy9LCgR/UT0c3S+RcieVPwMmnLJzmMPt6 PBwdzh/BOLHgnNgzE7A07GTpFmPb/hhrW0YAMOXNXP119r0utUws9M+yp 4AiroHQz1YX7NpqeXQp6+UTAPh0no4kyMr29pvkEHmy+PLWUC8lfZd+Ry 4qfUm/rfPPyyJpid0jMf3B85be8hwrpMzTbHA81+WBMad+yw8/Ttrjd0k pDgwZpI75GfPtWvMh9pfsOf3OEiULv2Xt/gsV4LFlYUsSqTRQDOrz0r28 lXKkdyM/2jfUnppLcPXninBQf8kTqmOnHFpTypXaoWcMm2aZ7+TsoTBLD g==; X-IronPort-AV: E=McAfee;i="6200,9189,10301"; a="240039504" X-IronPort-AV: E=Sophos;i="5.90,221,1643702400"; d="scan'208";a="240039504" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2022 21:30:22 -0700 X-IronPort-AV: E=Sophos;i="5.90,221,1643702400"; d="scan'208";a="565253787" Received: from unknown (HELO [10.249.164.87]) ([10.249.164.87]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2022 21:30:18 -0700 Message-ID: <1bd9b977-500c-602b-8b55-e5f8a13f39ce@linux.intel.com> Date: Wed, 30 Mar 2022 12:30:15 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Content-Language: en-US To: Jacob Pan References: <20220329053800.3049561-1-baolu.lu@linux.intel.com> <20220329053800.3049561-2-baolu.lu@linux.intel.com> <20220329140015.70c073b6@jacob-builder> From: Lu Baolu Subject: Re: [PATCH RFC v2 01/11] iommu: Add pasid_bits field in struct dev_iommu In-Reply-To: <20220329140015.70c073b6@jacob-builder> Content-Type: text/plain; charset=UTF-8; format=flowed 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,NICE_REPLY_A,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 Jacob, On 2022/3/30 5:00, Jacob Pan wrote: > Hi BaoLu, > > On Tue, 29 Mar 2022 13:37:50 +0800, Lu Baolu > wrote: > >> Use this field to save the pasid/ssid bits that a device is able to >> support with its IOMMU hardware. It is a generic attribute of a device >> and lifting it into the per-device dev_iommu struct makes it possible >> to allocate a PASID for device without calls into the IOMMU drivers. >> Any iommu driver which suports PASID related features should set this >> field before features are enabled on the devices. >> >> Signed-off-by: Lu Baolu >> --- >> include/linux/iommu.h | 1 + >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++ >> drivers/iommu/intel/iommu.c | 5 ++++- >> 3 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >> index 6ef2df258673..36f43af0af53 100644 >> --- a/include/linux/iommu.h >> +++ b/include/linux/iommu.h >> @@ -368,6 +368,7 @@ struct dev_iommu { >> struct iommu_fwspec *fwspec; >> struct iommu_device *iommu_dev; >> void *priv; >> + unsigned int pasid_bits; > pasid_width? > PCI spec uses "Max PASID Width" > My understanding is that this field represents "the pasid bits that the device is able to use with its IOMMU". This field considers the capabilities of both device and IOMMU. This is the reason why I put it in the per-device iommu object and initialize it in the iommu probe_device() callback. Best regards, baolu