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.5 required=3.0 tests=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 99CE6ECE587 for ; Tue, 1 Oct 2019 13:19:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 69C4D2190F for ; Tue, 1 Oct 2019 13:19:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69C4D2190F 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 DF6E38E0006; Tue, 1 Oct 2019 09:19:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAE938E0001; Tue, 1 Oct 2019 09:19:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C94B98E0006; Tue, 1 Oct 2019 09:19:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id 9AAC88E0001 for ; Tue, 1 Oct 2019 09:19:09 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 3A4FB781C for ; Tue, 1 Oct 2019 13:19:09 +0000 (UTC) X-FDA: 75995271618.17.quilt77_8a14f5776a34d X-HE-Tag: quilt77_8a14f5776a34d X-Filterd-Recvd-Size: 3796 Received: from inca-roads.misterjones.org (inca-roads.misterjones.org [213.251.177.50]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Oct 2019 13:19:08 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.80) (envelope-from ) id 1iFI3N-0005kv-Pu; Tue, 01 Oct 2019 15:18:57 +0200 Date: Tue, 1 Oct 2019 14:18:48 +0100 From: Marc Zyngier To: Will Deacon Cc: Jia He , Catalin Marinas , Mark Rutland , James Morse , Matthew Wilcox , "Kirill A. Shutemov" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Punit Agrawal , Thomas Gleixner , Andrew Morton , hejianet@gmail.com, Kaly Xin Subject: Re: [PATCH v10 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af() Message-ID: <20191001141848.762296bd@why> In-Reply-To: <20191001125446.gknoofnm7az4wqf5@willie-the-truck> References: <20190930015740.84362-1-justin.he@arm.com> <20190930015740.84362-2-justin.he@arm.com> <20191001125446.gknoofnm7az4wqf5@willie-the-truck> Organization: Approximate X-Mailer: Claws Mail 3.17.4 (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: will@kernel.org, justin.he@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, james.morse@arm.com, willy@infradead.org, kirill.shutemov@linux.intel.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, punitagrawal@gmail.com, tglx@linutronix.de, akpm@linux-foundation.org, hejianet@gmail.com, Kaly.Xin@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.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, 1 Oct 2019 13:54:47 +0100 Will Deacon wrote: > On Mon, Sep 30, 2019 at 09:57:38AM +0800, Jia He wrote: > > We unconditionally set the HW_AFDBM capability and only enable it on > > CPUs which really have the feature. But sometimes we need to know > > whether this cpu has the capability of HW AF. So decouple AF from > > DBM by new helper cpu_has_hw_af(). > > > > Signed-off-by: Jia He > > Suggested-by: Suzuki Poulose > > Reviewed-by: Catalin Marinas > > --- > > arch/arm64/include/asm/cpufeature.h | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > > index 9cde5d2e768f..949bc7c85030 100644 > > --- a/arch/arm64/include/asm/cpufeature.h > > +++ b/arch/arm64/include/asm/cpufeature.h > > @@ -659,6 +659,16 @@ static inline u32 id_aa64mmfr0_parange_to_phys_shift(int parange) > > default: return CONFIG_ARM64_PA_BITS; > > } > > } > > + > > +/* Check whether hardware update of the Access flag is supported */ > > +static inline bool cpu_has_hw_af(void) > > +{ > > + if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM)) > > + return read_cpuid(ID_AA64MMFR1_EL1) & 0xf; > > 0xf? I think we should have a mask in sysreg.h for this constant. We don't have the mask, but we certainly have the shift. GENMASK(ID_AA64MMFR1_HADBS_SHIFT + 3, ID_AA64MMFR1_HADBS_SHIFT) is a bit of a mouthful though. Ideally, we'd have a helper for that. M. -- Without deviation from the norm, progress is not possible.