Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp822516img; Thu, 21 Mar 2019 09:38:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyY8DY1Zww7KRadmuYrNIdi7sRLhquFn6PYes+aphMj9GpK655oL15NyJaLw8Nf3pih897i X-Received: by 2002:a17:902:29aa:: with SMTP id h39mr4514379plb.190.1553186294796; Thu, 21 Mar 2019 09:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553186294; cv=none; d=google.com; s=arc-20160816; b=XuWqw0fNGbzCJa7o/D4u5h2+eyfsR1TdIbdj/Cb/vVquFd5sP+Jn4TwC3Dl5tzCLk0 IX3vAK7Ax20M3f6IolcvL5s2zPMJ6s4Sa9UVyuRHIWgqerUPuCsJXiYT3nWbRTtQ1V3P Kc2bBfdFxtBVNFSuHl0kPmkdPqCeuDzdIHmsc6/XeD86KLGGVZM0BEkBpUjJpZ5gWTdN jrHYuZf1J6qbYT/Njtip9rQhdtQSCQUznke6qNfz28Auf94BkNRJQ3Iugu5PsBmBKA1T DAy0X9g9tnUmvACjv7gRD74FlUWU+wtpWnGof49rsK4wboyKpsMZ4tj+ldi8q5snsYYo 9KCA== 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=VNbH+rCV7W2flDYzz7qXnz9QhaU2DUMuydMVvJDj5mQ=; b=laP19x7KY4Uqx4eMKNrKRTpnq3iocITIAmjNOF7/YP9VN1QszjbMjzQhud39/4ASn5 SRQE84Edr6Bw7FXtTAykUDynzk0fA0LDwcY7icbSqYkVrIh0gdhnAt3PHUgQM+gZyj5A rMgH5kh6H55secVv+jl4NCbPDOZdc0HF2vwogo9gZJ+Mu4O5Kwp61IBXj8OIjruvvdoy 0oCy3voARtFfpWD9dhSTN5BS3mHPol1Q9nNKmcdw42pW+vY0Sb+e0P7+2ydZ0iGWy0Lx mKAJzrlYsEYHheBEFLHg7B2/Tny1wPteACZg+Xja9udYBVTSSLd6LWF1vwh/emECiXKJ d0jw== 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 c7si4701010plo.274.2019.03.21.09.37.59; Thu, 21 Mar 2019 09:38:14 -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 S1728695AbfCUQg7 (ORCPT + 99 others); Thu, 21 Mar 2019 12:36:59 -0400 Received: from foss.arm.com ([217.140.101.70]:59424 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728676AbfCUQg4 (ORCPT ); Thu, 21 Mar 2019 12:36:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 293E0374; Thu, 21 Mar 2019 09:36:56 -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 396CA3F614; Thu, 21 Mar 2019 09:36:54 -0700 (PDT) From: Julien Grall To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: christoffer.dall@arm.com, 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: [PATCH RFC 07/14] arm64/mm: Introduce NUM_ASIDS Date: Thu, 21 Mar 2019 16:36:16 +0000 Message-Id: <20190321163623.20219-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190321163623.20219-1-julien.grall@arm.com> References: <20190321163623.20219-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(-) diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index 5a4c2b1aac71..fb13bc249951 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)) -- 2.11.0