From patchwork Thu Mar 21 16:36:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 160803 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1001901jan; Thu, 21 Mar 2019 09:37:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFjQwX18jaB4qj8gna+q2g66HUAEHjyvH4xhCQYkT7VzrrjVXa7mZRoV4C+/3ewJrbpOYS X-Received: by 2002:a17:902:681:: with SMTP id 1mr4542160plh.31.1553186220103; Thu, 21 Mar 2019 09:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553186220; cv=none; d=google.com; s=arc-20160816; b=txGo/PznTG4aUKEs4n3jd7vVVw1Pj3kw1xJhKJX0C669buyVN41hrPQI2/40jfax3Y f8DZjzZCX2JTVvh3ZOSTjlhRNu3pYZTkbrNG036EjpLeNiKBQZ28Z97WpJT4gkGJ85to qvHq2rs8AuWyE3pWr+a3FtndNz1KJQVfaKf/JYVRrFg48GUhpRgAUktSK33xj9v7Hsbg b08TItwlgQ3Oo9EuG8jJh9kZpRAaTdoNQRDTYlgFEWNej7BZz6iNe8z4d/nMi0uWOJ4a AKwrcig8fTcBm4iJ9w1/e3gcJeZiCGyp6jPmGTlsaCVkJhnWXIzRSOFX4p7Ua2hUH83n 9rhw== 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 n23si4667452plp.182.2019.03.21.09.36.59; Thu, 21 Mar 2019 09:37:00 -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 S1728675AbfCUQg4 (ORCPT + 31 others); Thu, 21 Mar 2019 12:36:56 -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(-) -- 2.11.0 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); }