From: Alex Van Brunt <avanbrunt@nvidia.com> To: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Will Deacon <will.deacon@arm.com>, Sudeep Holla <sudeep.holla@arm.com>, Catalin Marinas <catalin.marinas@arm.com> Cc: Alex Van Brunt <avanbrunt@nvidia.com>, <stable@vger.kernel.org> Subject: [PATCH v2 3/4] Revert "arm64: add helper functions to read I-cache attributes" Date: Thu, 29 Oct 2015 16:20:41 -0700 [thread overview] Message-ID: <1446160842-25787-3-git-send-email-avanbrunt@nvidia.com> (raw) In-Reply-To: <1446160842-25787-1-git-send-email-avanbrunt@nvidia.com> This reverts commit 80c517b0ff71a4c874fed9196fd990d2d9e911f3. This reverts a patch that attempt to query the CPU for cache geometry. It relied on NumSets and LineSize fields of CCSIDR to determine the cache geometry. However, the architectural documentation for these registers forbids such use: The parameters NumSets, Associativity, and LineSize in these registers define the architecturally visible parameters that are required for the cache maintenance by Set/Way instructions. They are not guaranteed to represent the actual microarchitectural features of a design. You cannot make any inference about the actual sizes of caches based on these parameters. Signed-off-by: Alex Van Brunt <avanbrunt@nvidia.com> Cc: <stable@vger.kernel.org> --- arch/arm64/include/asm/cachetype.h | 20 -------------------- arch/arm64/kernel/cpuinfo.c | 14 -------------- 2 files changed, 34 deletions(-) diff --git a/arch/arm64/include/asm/cachetype.h b/arch/arm64/include/asm/cachetype.h index 4c631a0..7a2e076 100644 --- a/arch/arm64/include/asm/cachetype.h +++ b/arch/arm64/include/asm/cachetype.h @@ -39,26 +39,6 @@ extern unsigned long __icache_flags; -#define CCSIDR_EL1_LINESIZE_MASK 0x7 -#define CCSIDR_EL1_LINESIZE(x) ((x) & CCSIDR_EL1_LINESIZE_MASK) - -#define CCSIDR_EL1_NUMSETS_SHIFT 13 -#define CCSIDR_EL1_NUMSETS_MASK (0x7fff << CCSIDR_EL1_NUMSETS_SHIFT) -#define CCSIDR_EL1_NUMSETS(x) \ - (((x) & CCSIDR_EL1_NUMSETS_MASK) >> CCSIDR_EL1_NUMSETS_SHIFT) - -extern u64 __attribute_const__ icache_get_ccsidr(void); - -static inline int icache_get_linesize(void) -{ - return 16 << CCSIDR_EL1_LINESIZE(icache_get_ccsidr()); -} - -static inline int icache_get_numsets(void) -{ - return 1 + CCSIDR_EL1_NUMSETS(icache_get_ccsidr()); -} - /* * Whilst the D-side always behaves as PIPT on AArch64, aliasing is * permitted in the I-cache. diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index e0c6c8c..ae04ac1 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -21,10 +21,8 @@ #include <asm/cpufeature.h> #include <linux/bitops.h> -#include <linux/bug.h> #include <linux/init.h> #include <linux/kernel.h> -#include <linux/preempt.h> #include <linux/printk.h> #include <linux/smp.h> @@ -244,15 +242,3 @@ void __init cpuinfo_store_boot_cpu(void) boot_cpu_data = *info; } - -u64 __attribute_const__ icache_get_ccsidr(void) -{ - u64 ccsidr; - - WARN_ON(preemptible()); - - /* Select L1 I-cache and read its size ID register */ - asm("msr csselr_el1, %1; isb; mrs %0, ccsidr_el1" - : "=r"(ccsidr) : "r"(1L)); - return ccsidr; -} -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: avanbrunt@nvidia.com (Alex Van Brunt) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] Revert "arm64: add helper functions to read I-cache attributes" Date: Thu, 29 Oct 2015 16:20:41 -0700 [thread overview] Message-ID: <1446160842-25787-3-git-send-email-avanbrunt@nvidia.com> (raw) In-Reply-To: <1446160842-25787-1-git-send-email-avanbrunt@nvidia.com> This reverts commit 80c517b0ff71a4c874fed9196fd990d2d9e911f3. This reverts a patch that attempt to query the CPU for cache geometry. It relied on NumSets and LineSize fields of CCSIDR to determine the cache geometry. However, the architectural documentation for these registers forbids such use: The parameters NumSets, Associativity, and LineSize in these registers define the architecturally visible parameters that are required for the cache maintenance by Set/Way instructions. They are not guaranteed to represent the actual microarchitectural features of a design. You cannot make any inference about the actual sizes of caches based on these parameters. Signed-off-by: Alex Van Brunt <avanbrunt@nvidia.com> Cc: <stable@vger.kernel.org> --- arch/arm64/include/asm/cachetype.h | 20 -------------------- arch/arm64/kernel/cpuinfo.c | 14 -------------- 2 files changed, 34 deletions(-) diff --git a/arch/arm64/include/asm/cachetype.h b/arch/arm64/include/asm/cachetype.h index 4c631a0..7a2e076 100644 --- a/arch/arm64/include/asm/cachetype.h +++ b/arch/arm64/include/asm/cachetype.h @@ -39,26 +39,6 @@ extern unsigned long __icache_flags; -#define CCSIDR_EL1_LINESIZE_MASK 0x7 -#define CCSIDR_EL1_LINESIZE(x) ((x) & CCSIDR_EL1_LINESIZE_MASK) - -#define CCSIDR_EL1_NUMSETS_SHIFT 13 -#define CCSIDR_EL1_NUMSETS_MASK (0x7fff << CCSIDR_EL1_NUMSETS_SHIFT) -#define CCSIDR_EL1_NUMSETS(x) \ - (((x) & CCSIDR_EL1_NUMSETS_MASK) >> CCSIDR_EL1_NUMSETS_SHIFT) - -extern u64 __attribute_const__ icache_get_ccsidr(void); - -static inline int icache_get_linesize(void) -{ - return 16 << CCSIDR_EL1_LINESIZE(icache_get_ccsidr()); -} - -static inline int icache_get_numsets(void) -{ - return 1 + CCSIDR_EL1_NUMSETS(icache_get_ccsidr()); -} - /* * Whilst the D-side always behaves as PIPT on AArch64, aliasing is * permitted in the I-cache. diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index e0c6c8c..ae04ac1 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -21,10 +21,8 @@ #include <asm/cpufeature.h> #include <linux/bitops.h> -#include <linux/bug.h> #include <linux/init.h> #include <linux/kernel.h> -#include <linux/preempt.h> #include <linux/printk.h> #include <linux/smp.h> @@ -244,15 +242,3 @@ void __init cpuinfo_store_boot_cpu(void) boot_cpu_data = *info; } - -u64 __attribute_const__ icache_get_ccsidr(void) -{ - u64 ccsidr; - - WARN_ON(preemptible()); - - /* Select L1 I-cache and read its size ID register */ - asm("msr csselr_el1, %1; isb; mrs %0, ccsidr_el1" - : "=r"(ccsidr) : "r"(1L)); - return ccsidr; -} -- 2.1.4
next prev parent reply other threads:[~2015-10-29 23:19 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-10-29 23:20 [PATCH v2 1/4] Revert "arm64: kernel: add support for cpu cache information" Alex Van Brunt 2015-10-29 23:20 ` Alex Van Brunt 2015-10-29 23:20 ` [PATCH v2 2/4] Revert "arm64: don't flag non-aliasing VIPT I-caches as aliasing" Alex Van Brunt 2015-10-29 23:20 ` Alex Van Brunt 2015-10-29 23:20 ` Alex Van Brunt [this message] 2015-10-29 23:20 ` [PATCH v2 3/4] Revert "arm64: add helper functions to read I-cache attributes" Alex Van Brunt 2015-10-29 23:20 ` [PATCH v2 4/4] arm64: document the cache policy behavior Alex Van Brunt 2015-10-29 23:20 ` Alex Van Brunt 2015-10-30 12:08 ` Will Deacon 2015-10-30 12:08 ` Will Deacon
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1446160842-25787-3-git-send-email-avanbrunt@nvidia.com \ --to=avanbrunt@nvidia.com \ --cc=ard.biesheuvel@linaro.org \ --cc=catalin.marinas@arm.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=stable@vger.kernel.org \ --cc=sudeep.holla@arm.com \ --cc=will.deacon@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.