Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4260934pxu; Wed, 9 Dec 2020 12:21:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9/eNEps8G0YdB/fOLjZSsTcGi9NnjzObyYLRYjlPR6dz3GWHhDo52ofcFl6VX0fHhPwFc X-Received: by 2002:a05:6402:c83:: with SMTP id cm3mr3584849edb.189.1607545281445; Wed, 09 Dec 2020 12:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607545281; cv=none; d=google.com; s=arc-20160816; b=NSrNmJoSD+qC2gM5A88AIavvCuoHHnSKjrqq63rl9/MdyslToQGTo8M415vFPLmvHO bO6q6Z+YsgDe4txGClk9plAV08OxXprpfevUj0+Q6TdAJh1SkbU0eZIxynawWCOOqS09 KVMChLs8vFdWZQlGDrI+LIv9R5RB8hpj7B2K37pmyLdzL40z+M9FD4lPnO86bx64VQar LObgfJJo7ZrvmXcxiVAQDmWmcGZoQmC+WN7ZY6a0oMPNwrfnYPblpPJFGbEIhgpAnl+p AzT87ElwYYnsJJKCrc8HNtKb2cY9sCTN4DnvimvdEjvt/ObzOzsKtzyDwpAFr2xj6WmB +6XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=dePzOsNN8JyaJADr2BaFEhQGEORnCghIfGCkeBdXEMY=; b=LMbaYmKtrmaS7zazitAfoO4J1EPwroH50/wWOlwowbU9sDOTxV3+REZxmg0ZDGZeML 4ENa144Um0YFD4BU+e5LpyaXVSczffrz+s3Ome86lx7U9lH6WZlxbIpr1r7WMiUo5GYB qFHHXY/k8fHv1ab+ZHibH5ksJfElR/LXlQPHLqdjtlgMWGIcnvKandjMCyy+EsPwrcO4 hzTXaH2n5QeyLzmhnk8sCc+8KgbBPlIL+s3gnUPGyviwTIklST1sBW1lgBykyGwGBnwX b/H7zsh1ZH3Fafa2fk6dDGUKoX4TrNNkGfyvBpIyBGqrviO+IeZv5LT9rSvj/5gUgh0K Lm2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si1247138eju.331.2020.12.09.12.20.59; Wed, 09 Dec 2020 12:21:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733126AbgLISfy (ORCPT + 99 others); Wed, 9 Dec 2020 13:35:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:37962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733046AbgLISfy (ORCPT ); Wed, 9 Dec 2020 13:35:54 -0500 Date: Wed, 9 Dec 2020 18:35:09 +0000 From: Catalin Marinas To: Will Deacon Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Linus Torvalds , Vinayak Menon , kernel-team@android.com Subject: Re: [PATCH 2/2] arm64: mm: Implement arch_wants_old_faultaround_pte() Message-ID: <20201209183509.GH13566@gaia> References: <20201209163950.8494-1-will@kernel.org> <20201209163950.8494-3-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201209163950.8494-3-will@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 09, 2020 at 04:39:50PM +0000, Will Deacon wrote: > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index da250e4741bd..3424f5881390 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -764,6 +764,18 @@ static inline bool cpu_has_hw_af(void) > ID_AA64MMFR1_HADBS_SHIFT); > } > > +static inline bool system_has_hw_af(void) > +{ > + u64 mmfr1; > + > + if (!IS_ENABLED(CONFIG_ARM64_HW_AFDBM)) > + return false; > + > + mmfr1 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); > + return cpuid_feature_extract_unsigned_field(mmfr1, > + ID_AA64MMFR1_HADBS_SHIFT); > +} Could we not add a new system-wide cpu feature that checks for hardware AF? This read_sanitised_ftr_reg() does a binary search on each invocation. -- Catalin