Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6378480ybn; Sun, 29 Sep 2019 18:58:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyl1CSTRZfXBIdUI3NWSwR0p3qiq55ucsbXCKPEnUdwy3yV6xDR4lD1eEoy+polFwYrJQ77 X-Received: by 2002:a50:934c:: with SMTP id n12mr17450599eda.12.1569808711568; Sun, 29 Sep 2019 18:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569808711; cv=none; d=google.com; s=arc-20160816; b=vyDUsd5EwdwEvEyFQdhWQYREjMv9s2Wd/Qp/dOKxYX7d1LTyc8HWub59aT0ZfqP4hy EVjr2n5ac3wzrqaziqhhGH2PZzYEacuow+Z5xiWrcOcW2Xy3IQmqMO6LZpvmzYd5SKCB y8Pc96J+3fLBU8K2oIlpDDj3L3s25pHasJV7fLbzUgvi7N4LI8cH+w+KXBGBNSnicbu/ +5gfndbh9qioEyT/N53yAtiNycQr8gQctLjZdQZ4Fk8rXdYfHG2mlUjjiEoKco5BU2sZ 1v9NR4raYR4DjkCabLXATzNpABOLy8VWUDdudSSltH2ZVW/3kVQ/d8XPBoNrAVQSXxf2 zAqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=AcyNJ5iyz0bYhbfHJN14ZjqCqDUlwNjcKbiYqMVlOcQ=; b=xNE/pTEEeGa1xDZf/KST+ljRJXu04kjMg/Ntq8oQJHAjWgxWGn/nn5uGbyKB2FaL5l helpAH9D+Z3X3xUASpTUxZ87MNA2+ns0CHpHyLlu1XjynUg0gtOlqISQlO8q4c2oGETs om/a8meZ1pXOiVR/DVH7JrHG9XlynxIGlzYWuCZQV/3WovQ+2Mx++D4CG4BVoQC+FhWd S4LvcOH8jlWlaXvG+IZrVKm6JpXNrSGE1hxu6J987MIiAtFrihutFuDfSDKeVhn78KpJ ziR3wYvtSmiLnWaVVYEqplT31EQbggW7snN4nhDXpZzFZdm/IYWF8qy9FP8IsX1iMM/v C2dw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si6229461ejj.334.2019.09.29.18.58.07; Sun, 29 Sep 2019 18:58:31 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729303AbfI3B56 (ORCPT + 99 others); Sun, 29 Sep 2019 21:57:58 -0400 Received: from foss.arm.com ([217.140.110.172]:45382 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfI3B55 (ORCPT ); Sun, 29 Sep 2019 21:57:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7902C1570; Sun, 29 Sep 2019 18:57:57 -0700 (PDT) Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com [10.169.40.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A23343F706; Sun, 29 Sep 2019 18:57:53 -0700 (PDT) From: Jia He To: Catalin Marinas , Will Deacon , Mark Rutland , James Morse , Marc Zyngier , Matthew Wilcox , "Kirill A. Shutemov" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Punit Agrawal , Thomas Gleixner , Andrew Morton , hejianet@gmail.com, Kaly Xin , Jia He Subject: [PATCH v10 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af() Date: Mon, 30 Sep 2019 09:57:38 +0800 Message-Id: <20190930015740.84362-2-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190930015740.84362-1-justin.he@arm.com> References: <20190930015740.84362-1-justin.he@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; + + return false; +} + #endif /* __ASSEMBLY__ */ #endif -- 2.17.1