Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5077439rwl; Mon, 3 Apr 2023 14:05:52 -0700 (PDT) X-Google-Smtp-Source: AKy350YWCmC9dk6Vv23n8QGVivThSnF+eNvjqfMbi3SMgBXisanHtCqz2NnLReabpwJeedLs4EGU X-Received: by 2002:a05:6a20:ba83:b0:d4:2ce:8c6e with SMTP id fb3-20020a056a20ba8300b000d402ce8c6emr40122pzb.47.1680555951982; Mon, 03 Apr 2023 14:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680555951; cv=none; d=google.com; s=arc-20160816; b=WZpOmZcDu6fgTxdm58+ER5Tgq/4yrBUl6KaBF3MgCZhnAgZT8n1KimJImpedu8u3J5 xUjuRXgkRs06vwWQpoi3OkDsly0376cQeCdVeHgRxmhVBKp/E1t+BXv+cMoe64OBxAwH rOPwEgq//KXn5j4AIiXJa6t3NlRlo5ldqNBpyNL10WnZ84r/DjqwvLHQ/K9cayEvTTh/ CO30l7Td5SmTsrYiZUjunlE0r2q0qs1UuxWZLUyceF8Oyi1Tx5pzDxue61s7FoT9L7Mq NXzheUrKSv/x/l2GQrrqXW8cYerwNFXw7P580kc+MAyL51ACi7j7QKSHZtEy/8NSWksi 7/Tg== 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=p8EuauqI4WgFbqCJwGjulivOJ+UkBGXYDYVS+l/vKO0=; b=VYX2PhjRpLi+oLSea4gffhDmMjHZUMZuo5TgilJxfxphpIKxLSrECb3a3KBFifJVFv BEIAAMu6Ox/A7Qxq/v+52HojJ6jkOa3nd//GVTyOBGBNtIZ3STPiKsNIjGM+q+pZha3X IrmVWV2svSuqQWkX5CQVzDTZFVpoEwR3QXgxbs6Y2eHG4+Xbp8XX7JzOFvbPnMdlbyV0 oAJ8UkDPUKR1QDO2a1LA9L8kayrE6f73uINMc/PtSH1pyoij5cwNwcBnPLrU/8RfL/01 W18gKNwEBix1diK7MnPgW0u2ew69zqIDc394FTa+sjmnBCs2NSPE6PaaieVTl6hJB1wt yFkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hWHpnHv8; 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 c12-20020a63ea0c000000b004fbcff506c5si8748418pgi.346.2023.04.03.14.05.38; Mon, 03 Apr 2023 14:05:51 -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=hWHpnHv8; 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 S233517AbjDCUvB (ORCPT + 99 others); Mon, 3 Apr 2023 16:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231961AbjDCUu7 (ORCPT ); Mon, 3 Apr 2023 16:50:59 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B862270C; Mon, 3 Apr 2023 13:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680555059; x=1712091059; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QCUoLVw47iTtBsFQi2zXYE8LF9BtmZtRq5ow7vbWoH0=; b=hWHpnHv8sFvoRLgwtZcZNd2aI10pVnQOp6A6xAfB/2CWEuDbvp1hFrYc wiyy+2w/AG/Kb8tuGHJB52reOe7ozy3O6/Z3zJOS683t/w8rS7pzhTfCm gxPqb4Cc8MFHeDdFQQLnYu3NoVs2ZwIaXPJnaf/L2cmhpenZ4507qZQTe fmw4Cvbov0197IebBdCCVHmF9XDNfSb7hv8cGKSKGdIdugiJ8KgzNC6BM Vp47TQEKQk81+K71exCyVvaQF8DNUSlNzSvTbYXhdmebDB/MywNbcV9RV tro7WWZLIMwaOX1V8IMzMgGRMlHqsBmDvyh3UDssgI0x3WGtSdazB6K4V A==; X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="321672228" X-IronPort-AV: E=Sophos;i="5.98,315,1673942400"; d="scan'208";a="321672228" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2023 13:50:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="688633632" X-IronPort-AV: E=Sophos;i="5.98,315,1673942400"; d="scan'208";a="688633632" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2023 13:50:58 -0700 Date: Mon, 3 Apr 2023 13:55:04 -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" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v3 3/7] iommu/sva: Support allocation of global PASIDs outside SVA Message-ID: <20230403135504.2bd89822@jacob-builder> In-Reply-To: <81fddd3e-bf6c-966a-b44b-b8a7c9c00591@linux.intel.com> References: <20230331231137.1947675-1-jacob.jun.pan@linux.intel.com> <20230331231137.1947675-4-jacob.jun.pan@linux.intel.com> <81fddd3e-bf6c-966a-b44b-b8a7c9c00591@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=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,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 Hi Baolu, On Sat, 1 Apr 2023 21:28:02 +0800, Baolu Lu wrote: > On 2023/4/1 7:11, Jacob Pan wrote: > > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > > index 54f535ff9868..f70478a11a5f 100644 > > --- a/include/linux/iommu.h > > +++ b/include/linux/iommu.h > > @@ -1187,6 +1187,9 @@ struct iommu_sva *iommu_sva_bind_device(struct > > device *dev, struct mm_struct *mm); > > void iommu_sva_unbind_device(struct iommu_sva *handle); > > u32 iommu_sva_get_pasid(struct iommu_sva *handle); > > +ioasid_t iommu_alloc_global_pasid(ioasid_t min, ioasid_t max); > > +void iommu_free_global_pasid(ioasid_t pasid); > > + > > #else > > static inline struct iommu_sva * > > iommu_sva_bind_device(struct device *dev, struct mm_struct *mm) > > @@ -1202,6 +1205,13 @@ static inline u32 iommu_sva_get_pasid(struct > > iommu_sva *handle) { > > return IOMMU_PASID_INVALID; > > } > > + > > +static inline ioasid_t iommu_alloc_global_pasid(ioasid_t min, ioasid_t > > max) +{ > > + return IOMMU_PASID_INVALID; > > +} > > + > > +static inline void iommu_free_global_pasid(ioasid_t pasid) {} > > static inline void mm_pasid_init(struct mm_struct *mm) {} > > static inline void mm_pasid_drop(struct mm_struct *mm) {} > > #endif /* CONFIG_IOMMU_SVA */ > > I don't think the function prototypes of > iommu_[alloc|free]_global_pasid() should be impacted by > CONFIG_IOMMU_SVA. Or I may overlooked something? you're right, the scope is beyond SVA now. It should be under CONFIG_IOMMU_API, i think. Thanks, Jacob