Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp823444img; Thu, 21 Mar 2019 09:39:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZEOy5/79FjNrxLuGn8tJV43qihLPLWcTnl4jZJ6k2iaMW7ZOF1gR7xbIomR6lsft9bE6L X-Received: by 2002:a62:70c9:: with SMTP id l192mr4230843pfc.207.1553186362736; Thu, 21 Mar 2019 09:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553186362; cv=none; d=google.com; s=arc-20160816; b=aolB0gSexhtYZcihhTWX1+/sl0MjFfnI1eaNR5fm7uN2YhyYgCDmkmxrC3BMcBb8Ae A1COGh6IvbcbXz3t/mCOaAc2sUJ69Ypd5N+HZ8yubHuGIQ1aN509wr2z/bDabwX/cF5X SyBaRz/s4AIYZtHn8ThUkCNU8VpXTbm0nsPkunliYPWYbsoKHnPL/o36axGDxxxRInhC k1zSV9sCdd/o563wI0ujL/X9UzqmS9BUqUESjQm4SN1/P1bkC7bnZbyQrOTYTA3XMtGr E7f8Mdv5Acqh466JOH58XfyB9z1TXZFjdXAc22cNUSptbFwDThlM/QoR1Yf79Vx3HV6c msjQ== 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=EKG6A6KxV4CTZd8FCHCG65L4bQLQCgvMxSM9xewNCEE=; b=Uk0XFQxqXUCwrlmtSwHBnXQqdCPJTiXkHfYaemjHKgEx7XKuk5rYdFdEOss0Fg1v/R k+GfzEQcPRHjtkazH5OYT5XlgPtYvka7Rlv+Fo2Nf3KGt29AJJoe+fl0sWdF5JHj9sfm hGZy9uj3poQjCNe9njF3B7Ggk9XXQLqqMbG8HHsKJsUXRll7cqc6Ob/13TCl1D3KiJpc r6TO6QZat/GOajy14uBfEqw0ixWwXJ/IYXOIQQyofO6T+hrywwBQHnWVW7FEaLJHl8ih pq4V3AVRBiqB+PbCO4wqVRpYniw9t3+DtdkAUFRrN7aD/Z3a5WBpJRAxDWd1UkCfevfc 36tw== 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 2si4477549pfd.129.2019.03.21.09.39.08; Thu, 21 Mar 2019 09:39:22 -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 S1728671AbfCUQgy (ORCPT + 99 others); Thu, 21 Mar 2019 12:36:54 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59398 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728653AbfCUQgw (ORCPT ); Thu, 21 Mar 2019 12:36:52 -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 C1893165C; Thu, 21 Mar 2019 09:36:51 -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 D1BD23F614; Thu, 21 Mar 2019 09:36:49 -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 05/14] arm64/mm: Remove dependency on MM in new_context Date: Thu, 21 Mar 2019 16:36:14 +0000 Message-Id: <20190321163623.20219-6-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 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(-) diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index e98ab348b9cb..488845c39c39 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); } -- 2.11.0