From patchwork Thu Jun 20 13:06:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 167336 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2049495ilk; Thu, 20 Jun 2019 06:07:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqym9KshbB90OAoEsPzBallSRSrl+JAJ6yUtdmQlivwYFbsAR1+848xBx6hEt6DEmS168ATm X-Received: by 2002:a17:90a:cb81:: with SMTP id a1mr2925308pju.81.1561036032189; Thu, 20 Jun 2019 06:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561036032; cv=none; d=google.com; s=arc-20160816; b=katRc/WYHrc6m2ewBTBgwn9EqyVr1nSs3PRuj6rxaRhp1L5IHnKebSE4oEpyz0044c vTJaHRsNkl8OWaS0QFeQuEvTXQ47at7XUYsOsYyN16IYSrP/XYQPtmEKRSSzy+s35O2H ftRvUs1iL7zt6ZfOVFQMOB7y4Ybs1Kl5vmtuyxANVePY6qhfKCJPqAC0ZoVQuGWljuuW 05Du9OR4mY2cGBHJ7qPMuJcHQY/cIr5uxfgwv1J6Hdxcfa49fBK1vXNaxVq8zSuW90NU KprYgJYUdMf0HSqNUNzIFrj8x9/1p5Hon56MzjTyC383Jf9OtByQ5QXZCL2GwzLciq3b GpQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=8Nzd+MAVGAvziU/3k6O9iwk8Ly94P+VbsOglEEZ+odI=; b=Ha6W8xfgYhRFZJgcWstGUoYuVv7+hgNpbKMSJGbSc2ofAWRUDmvSVz2dtq8awyC2Q9 IOduaUYg88LLLEPeazAaSsRBkRV3XlCcrarss/7UDFfhwxfIjHaBzmsFyLKl2JRY+8mp 603yetIjnh+VFBgEVSLrz//sALKK2nVxSiDmy4fWBP3ecvfPjbZfJ/b1Lmx34FKAat4f MkcGm1cXK3Zt6voGomCsTuhukacKMjLG112j3WcZIOo8MfilYv2Bf7ubpicejtwWfK0q QDPIXr493raPU5gPzsr39PDKVOb40ooN3lPRzpkANspxdTjCXS70tLBZQJavyG5f9NCO nHyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si5792428pgv.280.2019.06.20.06.07.11; Thu, 20 Jun 2019 06:07:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732117AbfFTNHK (ORCPT + 30 others); Thu, 20 Jun 2019 09:07:10 -0400 Received: from foss.arm.com ([217.140.110.172]:36780 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731998AbfFTNGe (ORCPT ); Thu, 20 Jun 2019 09:06:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D8415C0A; Thu, 20 Jun 2019 06:06:33 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82DB33F718; Thu, 20 Jun 2019 06:06:32 -0700 (PDT) From: Julien Grall To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: james.morse@arm.com, marc.zyngier@arm.com, julien.thierry@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Grall Subject: [RFC v2 07/14] arm64/mm: Introduce NUM_ASIDS Date: Thu, 20 Jun 2019 14:06:01 +0100 Message-Id: <20190620130608.17230-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190620130608.17230-1-julien.grall@arm.com> References: <20190620130608.17230-1-julien.grall@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At the moment ASID_FIRST_VERSION is used to know the number of ASIDs supported. As we are going to move the ASID allocator in a separate, it would be better to use a different name for external users. This patch adds NUM_ASIDS and implements ASID_FIRST_VERSION using it. Signed-off-by: Julien Grall --- arch/arm64/mm/context.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index d128f02644b0..beba8e5b4100 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -48,7 +48,9 @@ static DEFINE_PER_CPU(atomic64_t, active_asids); static DEFINE_PER_CPU(u64, reserved_asids); #define ASID_MASK(info) (~GENMASK((info)->bits - 1, 0)) -#define ASID_FIRST_VERSION(info) (1UL << ((info)->bits)) +#define NUM_ASIDS(info) (1UL << ((info)->bits)) + +#define ASID_FIRST_VERSION(info) NUM_ASIDS(info) #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 #define ASID_PER_CONTEXT 2 @@ -56,7 +58,7 @@ static DEFINE_PER_CPU(u64, reserved_asids); #define ASID_PER_CONTEXT 1 #endif -#define NUM_CTXT_ASIDS(info) (ASID_FIRST_VERSION(info) >> (info)->ctxt_shift) +#define NUM_CTXT_ASIDS(info) (NUM_ASIDS(info) >> (info)->ctxt_shift) #define asid2idx(info, asid) (((asid) & ~ASID_MASK(info)) >> (info)->ctxt_shift) #define idx2asid(info, idx) (((idx) << (info)->ctxt_shift) & ~ASID_MASK(info))