From patchwork Wed Jul 24 16:25:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169623 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10466403ilk; Wed, 24 Jul 2019 09:26:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwP4WfMUxA8vNrrpTsjEtXUamiDTKu72kybJzH5tqYAqypDdMIoNe5EXmz2rKs6pdRFdErK X-Received: by 2002:a17:902:2869:: with SMTP id e96mr83563771plb.203.1563985560560; Wed, 24 Jul 2019 09:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563985560; cv=none; d=google.com; s=arc-20160816; b=x5J3/GAxOqgPu7ecWDg8uVY46Bzu2CY084FwmcxG/IdT0wfuBJ/DcL/E48uAlVOyes zaJtSS6gMhy9CoB9A71bl4OvesrErmEn82pLM/yranymIrDWshEuZr1QbMCCbyb3vPxE KyMZRtLASRavRr8XxMf2Yg1aF0vq+BzPXUDQlskTfsMgXn447SukC+B4l6bVRyCgRQIY 6npdpbxOiKl6iMZt4wm6q+mF+FjZSH9fUqv6ER+Mp7NU5pkJbV59Rb0SKOpm4d0dXqjS cZXdurCj/HS3uSsJR/8CQpsY+irCxEyoG/bR2eWtpqAL+4KK5m2Mz5lb+xlQ6LhDEKff 1u7w== 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=kG3kUNzQFuHCVgJ+poia/ho+2tpcrmqK+CxantX62WE=; b=yLICpzQTZFp2zRfS62V2pgrgr2by3GblP4+y/NTdlkARGG+5q5jTrwlIASFVjdStsY B24IRO40qwUSLWYtcChTlYv8l97IoThg/vHPoR5BBh/iHga0Eh8UtiJCPDY/EsRy7Wx1 OLleQ5+dr2dMmblrNrE1Wq3asALsKfVEzxyOkP5sewAp2nAWl4nrszc6cvzCa5Z0bFHq Oz/t8h1aaloCZjkP2xbKc8xx2FyUYCjJCAR0FxufSAxE9IIb97o6HFsYLSZPdiqDrKm0 jvj7TOpaqFAjEgcEJJ7l/vdysZ9fLqD3tITQGproa1C1xWWzpmIsHCsTESJs0kCuypJa H3VA== 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 l63si15941264pfl.41.2019.07.24.09.26.00; Wed, 24 Jul 2019 09:26: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 S1728870AbfGXQZ6 (ORCPT + 29 others); Wed, 24 Jul 2019 12:25:58 -0400 Received: from foss.arm.com ([217.140.110.172]:43376 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbfGXQZz (ORCPT ); Wed, 24 Jul 2019 12:25:55 -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 F103E337; Wed, 24 Jul 2019 09:25:54 -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 9DB073F71F; Wed, 24 Jul 2019 09:25:53 -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 05/15] arm64/mm: Remove dependency on MM in new_context Date: Wed, 24 Jul 2019 17:25:24 +0100 Message-Id: <20190724162534.7390-6-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 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 b50f52a09baf..dfb0da35a541 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -140,10 +140,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) { @@ -225,7 +225,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); }