From patchwork Wed Jul 24 16:25:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169624 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10466467ilk; Wed, 24 Jul 2019 09:26:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCow6HC9RBZZGqRHZ8RfvVyyMEszBY6G9xAAnl+YnOIFoP1Bf2WiSIyHMi6YAqfItEG5Oe X-Received: by 2002:a17:90a:8c0c:: with SMTP id a12mr88408951pjo.67.1563985564733; Wed, 24 Jul 2019 09:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563985564; cv=none; d=google.com; s=arc-20160816; b=oJpy6nHEgR7CuJIfF7Rh8454KQLFyLXhY97g086OiLSdYsxHkQ2AQNG4AE6HJxvgTP gCBXPrKUI5dCWXFhjFg6xT2Ua48/3xWMQqEHe1tODjwjL3Dufcpwt6OyoPBzDx7hcTUr RDbPqBbVp1bJHVo+LDIGxJ92ulurZhUA6T8H5TmhaSaXqiqqs+7Zd4I6PTMgeaMco6mr 4He/QMiyCJvRuJHkSb5IMzvSNXHMs8FQaOO2HjcXG0QIpFGEHcBRXfMPNPt0bgBfr5N2 HRO2izfvIBu/QgvH2vTeXYyW37KVHIOTdTw3TpaCUXx1g1PUrGnZAk6++QfKOVearZR6 OnZA== 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=x+vNRYahee9g7BbZKMh22M1c5Cj3euK4RVv7N5DzXfU=; b=rBzT1uKm065hJHEWhO/Gy9netRYPyobwYhmzc5f/WFJXdO/DsYrLtnl64yjVYhD7lD 58jrSwdFUwNBgDXHH8H2+X2dhoFBQKHqL3XiWscRUWGfFN5r+PXQ7VgMNi1fXGs6KzhE vicK1ZnVUMGBZOiyYpyDyLh/Y4TE2oWxI88KIviL3wHjmwOniOXuxFfGE/9b6/gDcOG7 sxQ9IHrXQ+raE8cuR44JXrLoXonkZ76daQi8X8s7g7bMdANf64I+BnGXOsRTADX1/WDn k290DOxhWeMXrsmW8QLMP5MUV8fJBsL+eHruGml9PvluHH1HPdyb6LRyQoeO+QztavKQ Lw/A== 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 c127si18351142pfc.191.2019.07.24.09.26.04; Wed, 24 Jul 2019 09:26:04 -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 S1728886AbfGXQ0D (ORCPT + 29 others); Wed, 24 Jul 2019 12:26:03 -0400 Received: from foss.arm.com ([217.140.110.172]:43390 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728869AbfGXQZ6 (ORCPT ); Wed, 24 Jul 2019 12:25:58 -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 198EF15A1; Wed, 24 Jul 2019 09:25:58 -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 BA34C3F71F; Wed, 24 Jul 2019 09:25:56 -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: [PATCH v3 07/15] arm64/mm: Introduce NUM_ASIDS Date: Wed, 24 Jul 2019 17:25:26 +0100 Message-Id: <20190724162534.7390-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190724162534.7390-1-julien.grall@arm.com> References: <20190724162534.7390-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 2e1e495cd1d8..3b40ac4a2541 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -37,7 +37,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 @@ -45,7 +47,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))