Thread (19 messages) 19 messages, 8 authors, 2019-09-19

Re: [PATCH v4 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2019-09-18 16:45:53
Also in: linux-mm, lkml

On Wed, Sep 18, 2019 at 03:20:41PM +0100, Suzuki K Poulose wrote:
On 18/09/2019 14:19, Jia He wrote:
quoted
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
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);
  	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.c b/arch/arm64/kernel/cpufeature.c
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 struct arm64_cpu_capabilities *cap,
  	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).

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help