From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sinmsgout01.his.huawei.com (sinmsgout01.his.huawei.com [119.8.177.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 986D633DEED for ; Tue, 27 Jan 2026 12:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=119.8.177.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769515791; cv=none; b=LVut119rRdPE1mhPGk+jh1p34X8J3LRrZDXToMEgLTNrXruGT90uHQR4534rI6T1DMu88MElS8OQxKZI5cW4DJKq+mmDXm2+pj8XlpleKHtXof5ki5jY8RgkEnk4VAydUXMWTTqU29goZQeEqMMnrVYKusj1jW0idfUomzNlhn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769515791; c=relaxed/simple; bh=0ht0GH71hzGGLCQcknRcqyeEpSsI8HJ+K71g876ZSX8=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dL8kmJEO56e1asb2iCQUQqXA8qKHT1NHGoP1QnwmsNCjc9cevv30HGFZ2u7Fs4mmQbVvm16Nyg+hnHZF4haWpPO3yPq3UJJqrGb3kO5QvaPrQ23smfv4EhTdpBQfPMYLkmpE2nDdghiALV3Xa6KlAXZXjiNmXGA9ZuOm0b1g9To= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=G0/ZLQPg; arc=none smtp.client-ip=119.8.177.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="G0/ZLQPg" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=3FSHAdi8qXXJjWhIdVkFc1e+f+aeG5BUvV35EH1fXOE=; b=G0/ZLQPgWYWTIakxxFFMnhY6UaMvHtTmD0P5Ah6BaWsBAqAtU48w6TLPgp0Ik+L0xuLn7/S4s I3zdeE9PE9+5uIM/WNQTb4OJ8rGIQ/J2lwbmlphR7E4k8NgFcEwVV/1SvgWAq2cfYRWuTjT3ksz aM6E7zqk9uhFdG69pjCIoW0= Received: from frasgout.his.huawei.com (unknown [172.18.146.33]) by sinmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4f0kfr3XNmz1P7JJ; Tue, 27 Jan 2026 20:07:16 +0800 (CST) Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4f0khz27tMzJ46ZP; Tue, 27 Jan 2026 20:09:07 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id 2DD3140569; Tue, 27 Jan 2026 20:09:43 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 27 Jan 2026 12:09:42 +0000 Date: Tue, 27 Jan 2026 12:09:41 +0000 From: Jonathan Cameron To: Ryan Roberts CC: Will Deacon , Ard Biesheuvel , Catalin Marinas , Mark Rutland , Linus Torvalds , Oliver Upton , Marc Zyngier , "Dev Jain" , Linu Cherian , , Subject: Re: [PATCH v2 07/13] arm64: mm: Simplify __TLBI_RANGE_NUM() macro Message-ID: <20260127120941.00000090@huawei.com> In-Reply-To: <20260119172202.1681510-8-ryan.roberts@arm.com> References: <20260119172202.1681510-1-ryan.roberts@arm.com> <20260119172202.1681510-8-ryan.roberts@arm.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100010.china.huawei.com (7.191.174.197) To dubpeml500005.china.huawei.com (7.214.145.207) On Mon, 19 Jan 2026 17:21:54 +0000 Ryan Roberts wrote: > From: Will Deacon > > Since commit e2768b798a19 ("arm64/mm: Modify range-based tlbi to > decrement scale"), we don't need to clamp the 'pages' argument to fit > the range for the specified 'scale' as we know that the upper bits will > have been processed in a prior iteration. > > Drop the clamping and simplify the __TLBI_RANGE_NUM() macro. > > Signed-off-by: Will Deacon > Reviewed-by: Ryan Roberts > Reviewed-by: Dev Jain > Signed-off-by: Ryan Roberts Reviewed-by: Jonathan Cameron > --- > arch/arm64/include/asm/tlbflush.h | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > index a8513b649fe5..cac7768f3483 100644 > --- a/arch/arm64/include/asm/tlbflush.h > +++ b/arch/arm64/include/asm/tlbflush.h > @@ -207,11 +207,7 @@ static inline void __tlbi_level(tlbi_op op, u64 addr, u32 level) > * range. > */ > #define __TLBI_RANGE_NUM(pages, scale) \ > - ({ \ > - int __pages = min((pages), \ > - __TLBI_RANGE_PAGES(31, (scale))); \ > - (__pages >> (5 * (scale) + 1)) - 1; \ > - }) > + (((pages) >> (5 * (scale) + 1)) - 1) > > /* > * TLB Invalidation