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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 639FAC433FE for ; Wed, 9 Dec 2020 18:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39B6823C8F for ; Wed, 9 Dec 2020 18:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733136AbgLISfy (ORCPT ); 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 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=-10.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 093C2C433FE for ; Wed, 9 Dec 2020 18:36:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD36D23C8F for ; Wed, 9 Dec 2020 18:36:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD36D23C8F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bOg7rVMQW/DrKSSqNgLGvQIMd0+PiBMm9mxaoNANlQc=; b=RoVwqdW1XIOU/uysiXvmO2dkw K9L+02yYKnzXDQPgJPERPeBtAXWcVfjFl0jzp4v6PngP/QBs6GLcBBqv/KC5/UWZ1CBgDIDibSAby 2383RKND1maGaDLIyIjC0T0sqjFL85Ogdg9RhryCOvWP7EegiBOEfLMzdWUTbtxwM3uqK7L/A7It6 snOygEELPPoH2g7BTjua/Zc5ssrfobJfPwtNgxQAECyYP0KkLOpFdEPRJZWIfYFDcTDbtDg420NEd UiCQ0/sFkTaqG3SYaT+ibLp/RrMogxbvlQ29TBekpjiw5XqvmejHxCW6qsDLtoVSDyX0S+8PgxEik 6WacRQU7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn4J3-0006Xw-TP; Wed, 09 Dec 2020 18:35:17 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn4J1-0006Wy-GA for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2020 18:35:16 +0000 Date: Wed, 9 Dec 2020 18:35:09 +0000 From: Catalin Marinas To: Will Deacon 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-Disposition: inline In-Reply-To: <20201209163950.8494-3-will@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_133515_658099_09C34DAB X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , Minchan Kim , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vinayak Menon , "Kirill A . Shutemov" , Andrew Morton , Linus Torvalds , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel