From patchwork Thu Jun 20 13:05:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 167328 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2048759ilk; Thu, 20 Jun 2019 06:06:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiVOp6HCAXmZ1M5knh4PZbcns5DVX1hmmXzVrjsDlK4QcajuEgNv9f6GrABJYRw1pqLn0C X-Received: by 2002:a17:902:f087:: with SMTP id go7mr98576766plb.330.1561035997866; Thu, 20 Jun 2019 06:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561035997; cv=none; d=google.com; s=arc-20160816; b=btXE8YlKM6+j1EsidAsiWxcFtywzWCGegzrxz1Mo/wlpvQTD6hp8IPCGTiLS78allX EX2bms6Hh+BX/clFm+ildUlpNRgGm2y8sqx0JugW3Ht7LMxuuJMs4UFTt9VbnDArTP2J lX7AB15OKwj77gYSpTsnLDv+guKq/r7V0TgEB4x3Ai6u6KWwvP1Gyv7r0Xk6ZP1ZypvM IOxoAKaE7BsonqsKbs2LIr1CtHAU3rAHPCckTresB52mrEACOHvAJ1nZ0GkNXFRJpiIS FkcAFOyy0UtGDa/rvG4lINXjUtS5lVSWa0WhxEFaOkM2b8bDcn+oOcbOJNd9PLOn6cx2 O8Bg== 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=24yZrV7pHSWt9chUb9nOzOuaNeJajNqYzV2vYtipNco=; b=w+5jijSys84Bmj8ORYRG/N/jV/jn3UTwuMRqsN79C24mhP0ZBTkqAubJxFiZf3g6Af /4osJaEYYfzXy/mpApO0wdqbgK3xBQmncXYK2XK0Q5Xvw4z28eD1NNq2IR7l5YpOO91G F8txXuBJyjxlFXV9xyAgQtPfj7srYlfteQfhQ2jllYRtyfVE3huQwimlbqftLwMpy7HS B5vxrSPzFTz4BlrBB3abdwmJmpfCUoOfAyY8Xa9ixvzuCRYAkjosJpbFCH8QNlfp4JSU bL6WC4togQa3Dt3pywQIEqNJan96zT6foAO/vIT0Lev+QBfJD7WFaiMSKqhKuqZEAU7c edSw== 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 w184si20523122pfw.271.2019.06.20.06.06.37; Thu, 20 Jun 2019 06:06:37 -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 S1732018AbfFTNGf (ORCPT + 30 others); Thu, 20 Jun 2019 09:06:35 -0400 Received: from foss.arm.com ([217.140.110.172]:36764 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731983AbfFTNGb (ORCPT ); Thu, 20 Jun 2019 09:06:31 -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 BA0D5360; Thu, 20 Jun 2019 06:06:30 -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 659053F73F; Thu, 20 Jun 2019 06:06:29 -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 05/14] arm64/mm: Remove dependency on MM in new_context Date: Thu, 20 Jun 2019 14:05:59 +0100 Message-Id: <20190620130608.17230-6-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 The function new_context will be part of a generic ASID allocator. At the moment, the MM structure is only used to fetch the ASID. To remove the dependency on MM, it is possible to just pass a pointer to the current ASID. Signed-off-by: Julien Grall --- arch/arm64/mm/context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index 6457a9310fe4..a9cc59288b08 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -151,10 +151,10 @@ static bool check_update_reserved_asid(struct asid_info *info, u64 asid, return hit; } -static u64 new_context(struct asid_info *info, struct mm_struct *mm) +static u64 new_context(struct asid_info *info, atomic64_t *pasid) { static u32 cur_idx = 1; - u64 asid = atomic64_read(&mm->context.id); + u64 asid = atomic64_read(pasid); u64 generation = atomic64_read(&info->generation); if (asid != 0) { @@ -236,7 +236,7 @@ void check_and_switch_context(struct mm_struct *mm, unsigned int cpu) /* Check that our ASID belongs to the current generation. */ asid = atomic64_read(&mm->context.id); if ((asid ^ atomic64_read(&info->generation)) >> info->bits) { - asid = new_context(info, mm); + asid = new_context(info, &mm->context.id); atomic64_set(&mm->context.id, asid); }