Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp996452rwr; Thu, 27 Apr 2023 10:48:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6jKK+cC6H/w+rSQmH6NuuiYEr5trSqbaUSJkRoKVhUhIjuXr6m6+VB+BXCSNhlksUqrtF9 X-Received: by 2002:a05:6a20:9593:b0:f5:c6d5:adf5 with SMTP id iu19-20020a056a20959300b000f5c6d5adf5mr2628165pzb.40.1682617695290; Thu, 27 Apr 2023 10:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682617695; cv=none; d=google.com; s=arc-20160816; b=ba/O0YJOqHcqu+aVQ0NSLjJe2eLax6VrBOHLeK+Q+NrImvyTCYAz8iPeXtGfVRyWSi kzjTR0rpTW3g7175KdM1ICLEJhVlJc837jGokalCNNGHihwlWqrNfr1ykdEbaghbDcf2 3MDp0ToOa7ducQVXK3DbU1lodUhBCY27RtRfyBzX0N6ZXgFTdOSC3dlpFqf3Ok5XiArB JHkYxCe2ggwHlh0+lHVlle6RJUhNtDtWeeBNWEOIwdcjbt9789buvf2ZnRecnuz6nAs1 lpmqKHxIw42ZYipjWp6P2bVs4wKK0GiLxmN0PszpPTJtFaLkwjZyrsO9jDzF1oIsNlHi PDFA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GN6w8qOOzwHCsu+9HjCrZTjgb9ZA05yNy9UlnUgrjn8=; b=u8DTS4yn9TEJi6uYcqbHYlq0WWRSndGM+JKobI+dFs6QIk2zJ68iN2XqrJdiFSZogs d1dwyWd02cGB18TnwPbyy+ROFz5s8a9fBynsfWlSLT+shzliPkHlnp1jNf3DVCNg7Yyz oU6aRY8Zp2nUoI7CQl1R7fdPv+1LCxrpBx82q4nbctLlJ+vN+inDNASK+oLcdkboLtzC M/90QkN5fz1VbYxgChUMOFxI3Rw67Nw6zrfLAGEDiwd8vt+vgeHM0pUYomII/NRrvoe+ Wk7HA2FBFa5eWFs2jNhmyqRXGiv+sGM0YHznx5sqf7Mk60chg6OEhnH5rYtWrprSKjha xY0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ciYR0MYw; 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 r6-20020aa79ec6000000b0063affab9401si19012562pfq.384.2023.04.27.10.48.02; Thu, 27 Apr 2023 10:48:15 -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=ciYR0MYw; 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 S244308AbjD0Rpu (ORCPT + 99 others); Thu, 27 Apr 2023 13:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244409AbjD0Rpk (ORCPT ); Thu, 27 Apr 2023 13:45:40 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B724233; Thu, 27 Apr 2023 10:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682617523; x=1714153523; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sUwpT3UJslOINCLJ0IN/Qa1aCnftYprMhdpAjRPm5/Y=; b=ciYR0MYwUGGACADHMXWzkZIwKn0K1Z/IQaKXidGtqZohfuTspkXmgcvR F5h9gGQ1PzdU8TUsaJL+6ILvKIhiSVC9h/3QZZ4p6LrxIxIH6zzg4kJHd 7xr09rigBynA6QDbusaQTb1/WLXzVjOS8qzq9OWeT2wL+aevW5H2O0wlp kp7MdPr4IA6Me8ppRUfUtRkutBznaQe3m+sqvrCYOrR7lZclkqW1XvU+D VBG3fSVT5qFMoJ4JEYFq4jUPf42Jjcb7gsIv4q7kKYqppVogcnXuMiPA+ ncuIvZ6XtkPXLPZnY5LZF3biJN2bmkhUHW0R6oLmIi3kwt9z/1ElwzScI g==; X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="350398707" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="350398707" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 10:45:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="1024219698" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="1024219698" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by fmsmga005.fm.intel.com with ESMTP; 27 Apr 2023 10:45:20 -0700 From: Jacob Pan To: LKML , iommu@lists.linux.dev, "Robin Murphy" , Jason Gunthorpe , "Lu Baolu" , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org Cc: "Will Deacon" , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , narayan.ranganathan@intel.com, Jacob Pan Subject: [PATCH v5 2/7] iommu/sva: Explicitly exclude RID_PASID from SVA Date: Thu, 27 Apr 2023 10:49:32 -0700 Message-Id: <20230427174937.471668-3-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230427174937.471668-1-jacob.jun.pan@linux.intel.com> References: <20230427174937.471668-1-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 SVA PASID allocation is hardcoded to start from 1 because 0 is used for RID_PASID, let's make it explicit to avoid the potential conflicts. Signed-off-by: Jacob Pan --- drivers/iommu/iommu-sva.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index c434b95dc8eb..ac7c93bacb5c 100644 --- a/drivers/iommu/iommu-sva.c +++ b/drivers/iommu/iommu-sva.c @@ -66,7 +66,7 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm return ERR_PTR(-EOPNOTSUPP); /* Allocate mm->pasid if necessary. */ - ret = iommu_sva_alloc_pasid(mm, 1, max_pasids - 1); + ret = iommu_sva_alloc_pasid(mm, IOMMU_DEF_RID_PASID + 1, max_pasids - 1); if (ret) return ERR_PTR(ret); -- 2.25.1