RE: [PATCH v4 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()
From: Justin He (Arm Technology China) <hidden>
Date: 2019-09-19 01:55:36
Also in:
linux-mm, lkml
Hi Suzuki
-----Original Message----- From: Catalin Marinas <catalin.marinas@arm.com> Sent: 2019年9月19日 0:46 To: Suzuki Poulose <Suzuki.Poulose@arm.com> Cc: Justin He (Arm Technology China) <redacted>; Will Deacon [off-list ref]; Mark Rutland [off-list ref]; James Morse [off-list ref]; Marc Zyngier [off-list ref]; Matthew Wilcox [off-list ref]; Kirill A. Shutemov [off-list ref]; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; linux-mm@kvack.org; Punit Agrawal [off-list ref]; Anshuman Khandual [off-list ref]; Jun Yao [off-list ref]; Alex Van Brunt [off-list ref]; Robin Murphy [off-list ref]; Thomas Gleixner [off-list ref]; Andrew Morton [off-list ref]; Jérôme Glisse [off-list ref]; Ralph Campbell [off-list ref]; hejianet@gmail.com; Kaly Xin (Arm Technology China) [off-list ref] Subject: Re: [PATCH v4 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af() On Wed, Sep 18, 2019 at 03:20:41PM +0100, Suzuki K Poulose wrote:quoted
On 18/09/2019 14:19, Jia He wrote:quoted
diff --git a/arch/arm64/include/asm/cpufeature.hb/arch/arm64/include/asm/cpufeature.hquoted
quoted
index c96ffa4722d3..206b6e3954cf 100644--- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h@@ -390,6 +390,7 @@ extern DECLARE_BITMAP(boot_capabilities,ARM64_NPATCHABLE);quoted
quoted
for_each_set_bit(cap, cpu_hwcaps, ARM64_NCAPS) bool this_cpu_has_cap(unsigned int cap); +bool cpu_has_hw_af(void); void cpu_set_feature(unsigned int num); bool cpu_have_feature(unsigned int num); unsigned long cpu_get_elf_hwcap(void);diff --git a/arch/arm64/kernel/cpufeature.cb/arch/arm64/kernel/cpufeature.cquoted
quoted
index b1fdc486aed8..c5097f58649d 100644--- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c@@ -1141,6 +1141,12 @@ static bool has_hw_dbm(const structarm64_cpu_capabilities *cap,quoted
quoted
return true; } +/* Decouple AF from AFDBM. */ +bool cpu_has_hw_af(void) +{Sorry for not having asked this earlier. Are we interested in, "whether *this* CPU has AF support ?" or "whether *at least one* CPU has the AF support" ? The following code does the former.quoted
+ return (read_cpuid(ID_AA64MMFR1_EL1) & 0xf);In a non-preemptible context, the former is ok (per-CPU).
Yes, just as what Catalin explained, we need the former because the pagefault occurred in every cpus -- Cheers, Justin (Jia He)
-- Catalin
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel