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 X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8F8FC43331 for ; Tue, 24 Mar 2020 14:19:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 62E7B2080C for ; Tue, 24 Mar 2020 14:19:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="j8uY0T2T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62E7B2080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D8F7A6B0003; Tue, 24 Mar 2020 10:19:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D40FD6B0005; Tue, 24 Mar 2020 10:19:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C55A06B0007; Tue, 24 Mar 2020 10:19:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id ABA136B0003 for ; Tue, 24 Mar 2020 10:19:45 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 793FE8248047 for ; Tue, 24 Mar 2020 14:19:45 +0000 (UTC) X-FDA: 76630464330.30.sky50_551cb3d46c13f X-HE-Tag: sky50_551cb3d46c13f X-Filterd-Recvd-Size: 5110 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 14:19:44 +0000 (UTC) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9247320788; Tue, 24 Mar 2020 14:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585059583; bh=BiuF+8C09ZXZT+Y0m0yfA1PY8+9yZbVyGyhq0q53CDM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=j8uY0T2TR1Jwh+mYP5o7fUfBxvYDj2Sl4idAVhraSsAtcBNSoG2GLTa2Nhw5StfCf Ord/lxL5FmP3Ezz+JZlTqLqPH1cmdjcjL6QF1isp83h4j0zilyyvUqlLU10rl1I0pF OouqDxnm0K0Vg5g6FDFTf99yq8YWeEY9bWfUeSA4= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGkP7-00FIiG-KS; Tue, 24 Mar 2020 14:19:41 +0000 Date: Tue, 24 Mar 2020 14:19:39 +0000 From: Marc Zyngier To: Zhenyu Ye Cc: , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH v4 3/6] arm64: Add level-hinted TLB invalidation helper to tlbi_user Message-ID: <20200324141939.51917225@why> In-Reply-To: <20200324134534.1570-4-yezhenyu2@huawei.com> References: <20200324134534.1570-1-yezhenyu2@huawei.com> <20200324134534.1570-4-yezhenyu2@huawei.com> Organization: Approximate X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: yezhenyu2@huawei.com, will@kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, aneesh.kumar@linux.ibm.com, akpm@linux-foundation.org, npiggin@gmail.com, peterz@infradead.org, arnd@arndb.de, rostedt@goodmis.org, suzuki.poulose@arm.com, tglx@linutronix.de, yuzhao@google.com, Dave.Martin@arm.com, steven.price@arm.com, broonie@kernel.org, guohanjun@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, arm@kernel.org, xiexiangyou@huawei.com, prime.zeng@hisilicon.com, zhangshaokun@hisilicon.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 24 Mar 2020 21:45:31 +0800 Zhenyu Ye wrote: > Add a level-hinted parameter to __tlbi_user, which only gets used > if ARMv8.4-TTL gets detected. > > ARMv8.4-TTL provides the TTL field in tlbi instruction to indicate > the level of translation table walk holding the leaf entry for the > address that is being invalidated. > > This patch set the default level value to 0. > > Signed-off-by: Zhenyu Ye > --- > arch/arm64/include/asm/tlbflush.h | 42 ++++++++++++++++++++++++++----- > 1 file changed, 36 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > index a3f70778a325..d141c080e494 100644 > --- a/arch/arm64/include/asm/tlbflush.h > +++ b/arch/arm64/include/asm/tlbflush.h > @@ -89,6 +89,36 @@ > __tlbi(op, arg); \ > } while(0) > > +#define __tlbi_user_level(op, addr, level) \ > + do { \ > + u64 arg = addr; \ > + \ > + if (!arm64_kernel_unmapped_at_el0()) \ > + break; \ > + \ > + if (cpus_have_const_cap(ARM64_HAS_ARMv8_4_TTL) && \ > + level) { \ > + u64 ttl = level; \ > + \ > + switch (PAGE_SIZE) { \ > + case SZ_4K: \ > + ttl |= 1 << 2; \ > + break; \ > + case SZ_16K: \ > + ttl |= 2 << 2; \ > + break; \ > + case SZ_64K: \ > + ttl |= 3 << 2; \ > + break; \ > + } \ > + \ > + arg &= ~TLBI_TTL_MASK; \ > + arg |= FIELD_PREP(TLBI_TTL_MASK, ttl); \ > + } \ > + \ > + __tlbi(op, (arg) | USER_ASID_FLAG); > \ > + } while (0) > + Isn't this just: define __tlbi_user_level(op, addr, level) \ do { \ if (!arm64_kernel_unmapped_at_el0()) \ break; \ \ __tlbi_level(op, addr | USER_ASID_FLAG, level); \ } while (0) Thanks, M. -- Jazz is not dead. It just smells funny...