Thread (8 messages) 8 messages, 2 authors, 2019-09-20

RE: [PATCH v5 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

From: Justin He (Arm Technology China) <hidden>
Date: 2019-09-20 01:14:40
Also in: linux-mm, lkml

Hi Catalin
-----Original Message-----
From: Catalin Marinas <catalin.marinas@arm.com>
Sent: 2019年9月20日 0:37
To: Justin He (Arm Technology China) <redacted>
Cc: Will Deacon <will@kernel.org>; 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; Suzuki Poulose [off-list ref]; Punit
Agrawal [off-list ref]; Anshuman Khandual
[off-list ref]; Alex Van Brunt
[off-list ref]; Robin Murphy [off-list ref];
Thomas Gleixner [off-list ref]; Andrew Morton <akpm@linux-
foundation.org>; 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 v5 1/3] arm64: cpufeature: introduce helper
cpu_has_hw_af()

On Fri, Sep 20, 2019 at 12:12:02AM +0800, Jia He wrote:
quoted
diff --git a/arch/arm64/kernel/cpufeature.c
b/arch/arm64/kernel/cpufeature.c
quoted
index b1fdc486aed8..fb0e9425d286 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1141,6 +1141,16 @@ static bool has_hw_dbm(const struct
arm64_cpu_capabilities *cap,
quoted
    return true;
 }

+/* Decouple AF from AFDBM. */
+bool cpu_has_hw_af(void)
+{
+   return (read_cpuid(ID_AA64MMFR1_EL1) & 0xf);
+}
+#else /* CONFIG_ARM64_HW_AFDBM */
+bool cpu_has_hw_af(void)
+{
+   return false;
+}
 #endif
Please place this function in cpufeature.h directly, no need for an
additional function call. Something like:

static inline bool cpu_has_hw_af(void)
{
      if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM))
              return read_cpuid(ID_AA64MMFR1_EL1) & 0xf;
      return false;
}
Ok, thanks

--
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help