Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8304085ybn; Tue, 1 Oct 2019 06:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAW22sRmByI8yzSbvde+g7zfjPeYlsHw6lZtWeNNPuHTj88qCmxhUfKtqTWA6E6Y1XdF7w X-Received: by 2002:adf:f78f:: with SMTP id q15mr18844063wrp.389.1569936068957; Tue, 01 Oct 2019 06:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569936068; cv=none; d=google.com; s=arc-20160816; b=I3Fqvw/XJ7M+yaQJWz6SJlfIKMCvhUMegWmp2E8fnkiC3zuOKzMA+H6gjYX8Cj8HTT 2VD0k0Huq9k1Rijh1eZ9SLYGHyk74A4JjDIH3//7JbqqfqTwnQSvNX5p6L3Ybk7c5Qyp +TVkNz+4KinjW5dM1766786Qh9TDwySB2NAVEpBfq1QVFZhMS5ahCrR5gd4obSM6s2Nv GRdq+z5XI+y/T+lKKcl2WTiJK1blvyNvqxFBKfqmKGLpX7RMcx3/15EFLLmg9MO3xk5m 4OQb3sl8lU90oR0Q4aJ5h0adp5HIPQUoH1ouam+yNQEYtYFPT4ZjpuN38lsbFWSD0ybS U5BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=Dbx8KzaOQiz+pHxxJPb/tdzU+bphw4epu39UWiekKt8=; b=blmD1ohBsA23+zUsO7iQVuNJPYsTEVpIpp8ywVeQxpYT9lbjRXCBYbAwZQq8+9RiWg vXD3Vt3UGjwu0rYDP6xqY8R09TIEeJGoOoSfsg37xIsZ6I+9FLL3YdAcOMHWEPEKNqPa VcGB1cus2Z2PHJfvvtwKLDp8b1g/7lms0t0qahetSgYtRBw7U5Brr7z6T1hNjzxjv71j zaqa7hcpsXO3hLdSPvx7pMsVoCrbbp9eHJBzukBA1I3VcM9z8Ak6QKBUXOIPQ4n3IKXf /VSuv9EEMoVWQDCiiwiwjBrX3HzXwKscJgdOoVoaEHzVvY94sE3gaQiNLLFY58BcuSBc RUGQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22si8397485ejx.203.2019.10.01.06.20.43; Tue, 01 Oct 2019 06:21:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388298AbfJANTH (ORCPT + 99 others); Tue, 1 Oct 2019 09:19:07 -0400 Received: from inca-roads.misterjones.org ([213.251.177.50]:38169 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388005AbfJANTH (ORCPT ); Tue, 1 Oct 2019 09:19:07 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.