From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C365EC433F5 for ; Mon, 6 Dec 2021 16:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Irr008AHLE6Nc4zhy0LqDpdvGDxWCeakwrdYPRicY6Y=; b=nXjDKHmvbH4nTs kSm0+px116Oyru1w5R6B5tnI5G72FJOg849bOO721sSC4LY7GYfpigLXVDTBI5WLjg06RnrQX/6Z4 3N8WkF9h7W0rJSMjblSQ8hqF6LCZmE0pX4Sb2F5dAmzRtzKZdDHolhO2f6nCkY9uJU2o0oFEVfOZN ZZzC6IHZSD+7CVMivvp3besAakQ8txstGOihOpk13mewg5rTESSVmnk7mLOMUHHeZMJboY/x783Og sKqVqe8fWSfKKBpF6UZXvfya3kR+QrPv1Qdkq5WxthaeKCg/5sI8uz6SOIEJw9AU3bzJWT/w9ACcK rcECMQpYCvbkqcl7/DNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muGm2-004lK3-3H; Mon, 06 Dec 2021 16:23:30 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muGly-004lJS-Ck for linux-arm-kernel@lists.infradead.org; Mon, 06 Dec 2021 16:23:27 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64A2761369; Mon, 6 Dec 2021 16:23:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F51EC341C1; Mon, 6 Dec 2021 16:23:23 +0000 (UTC) Date: Mon, 6 Dec 2021 16:23:20 +0000 From: Catalin Marinas To: Yunfeng Ye Cc: will@kernel.org, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, wuxu.wu@huawei.com, Hewenliang Subject: Re: [PATCH] arm64: mm: Use asid2idx() and asid feature macro for cleanup Message-ID: References: <4aaabf1b-00c3-3365-e371-9d97dc0c06ab@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4aaabf1b-00c3-3365-e371-9d97dc0c06ab@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_082326_497019_2B6F9E01 X-CRM114-Status: GOOD ( 19.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 28, 2021 at 08:27:23PM +0800, Yunfeng Ye wrote: > Use asid2idx() and asid feature macro for cleanup. > > No functional change. > > Signed-off-by: Yunfeng Ye > --- > arch/arm64/mm/context.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c > index cd72576ae2b7..076f14a75bd5 100644 > --- a/arch/arm64/mm/context.c > +++ b/arch/arm64/mm/context.c > @@ -50,10 +50,10 @@ static u32 get_cpu_asid_bits(void) > pr_warn("CPU%d: Unknown ASID size (%d); assuming 8-bit\n", > smp_processor_id(), fld); > fallthrough; > - case 0: > + case ID_AA64MMFR0_ASID_8: > asid = 8; > break; > - case 2: > + case ID_AA64MMFR0_ASID_16: > asid = 16; > } I think this change is fine. > @@ -162,7 +162,7 @@ static u64 new_context(struct mm_struct *mm) > u64 generation = atomic64_read(&asid_generation); > > if (asid != 0) { > - u64 newasid = generation | (asid & ~ASID_MASK); > + u64 newasid = generation | asid2idx(asid); > > /* > * If our current ASID was active during a rollover, we > @@ -306,7 +306,7 @@ unsigned long arm64_mm_context_get(struct mm_struct *mm) > out_unlock: > raw_spin_unlock_irqrestore(&cpu_asid_lock, flags); > > - asid &= ~ASID_MASK; > + asid = asid2idx(asid); While functionally the code is the same, I don't think this was the intention of asid2idx(). It's meant to provide an index into asid_map, while the ASID_MASK lines isolate the asid number and add a new generation to it. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel