From patchwork Thu Mar 21 16:36:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 160804 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1001945jan; Thu, 21 Mar 2019 09:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCN7zheiGVF9Ig1Oz92X6Hd2GdQvCnmDPZa8Pisp5SKWzsq968XaI6p6yFdHZ9yK1QrcAQ X-Received: by 2002:a62:5c87:: with SMTP id q129mr4106580pfb.180.1553186222163; Thu, 21 Mar 2019 09:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553186222; cv=none; d=google.com; s=arc-20160816; b=yIFWksACLlK3IJFEwn2etiGK/myBuTASHm1RhwYO+SVGAXJoN7lha6ylCmOWg/YxGi UlmTqLaW56NVM8HOo6dkgnFjxDrQ34xK4dSuuYRohuMXR8gstG6s1iX8yRcmGGOwYOgm dwN90MNFzcTbLF1/HZY49tgFPf6ZpZ0F4ncatFwnmheoNGPFl95Mm/u0hoCDZT4ju7cr oia6f5hP6AG9wYBBkDjQMkSpqrlodd9XcsrjLnTT8LJY7c1ZdKDkR2Ofbc5MPbhMMf7W nxR4trh3MjsuhMjID4/WXCSgMTnd3Xb5FYDTeqVO5zSXVO5srOyP02+M2bpJIPAABIk2 CgcQ== 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 p3si821984pgr.382.2019.03.21.09.37.01; Thu, 21 Mar 2019 09:37:02 -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 S1728699AbfCUQg7 (ORCPT + 31 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(-) -- 2.11.0 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))