mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
arm64: Handle mismatched cache type
commit314d53d297upstream. Track mismatches in the cache type register (CTR_EL0), other than the D/I min line sizes and trap user accesses if there are any. Fixes:be68a8aaf9("arm64: cpufeature: Fix CTR_EL0 field definitions") Cc: <stable@vger.kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
faed5cb96b
commit
ca41d82d4e
@@ -49,7 +49,8 @@
|
|||||||
#define ARM64_HAS_CACHE_DIC 28
|
#define ARM64_HAS_CACHE_DIC 28
|
||||||
#define ARM64_HW_DBM 29
|
#define ARM64_HW_DBM 29
|
||||||
#define ARM64_SSBD 30
|
#define ARM64_SSBD 30
|
||||||
|
#define ARM64_MISMATCHED_CACHE_TYPE 31
|
||||||
|
|
||||||
#define ARM64_NCAPS 31
|
#define ARM64_NCAPS 32
|
||||||
|
|
||||||
#endif /* __ASM_CPUCAPS_H */
|
#endif /* __ASM_CPUCAPS_H */
|
||||||
|
|||||||
@@ -65,11 +65,15 @@ is_kryo_midr(const struct arm64_cpu_capabilities *entry, int scope)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry,
|
has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry,
|
||||||
int scope)
|
int scope)
|
||||||
{
|
{
|
||||||
u64 mask = CTR_CACHE_MINLINE_MASK;
|
u64 mask = CTR_CACHE_MINLINE_MASK;
|
||||||
|
|
||||||
|
/* Skip matching the min line sizes for cache type check */
|
||||||
|
if (entry->capability == ARM64_MISMATCHED_CACHE_TYPE)
|
||||||
|
mask ^= arm64_ftr_reg_ctrel0.strict_mask;
|
||||||
|
|
||||||
WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
|
WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
|
||||||
return (read_cpuid_cachetype() & mask) !=
|
return (read_cpuid_cachetype() & mask) !=
|
||||||
(arm64_ftr_reg_ctrel0.sys_val & mask);
|
(arm64_ftr_reg_ctrel0.sys_val & mask);
|
||||||
@@ -615,7 +619,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|||||||
{
|
{
|
||||||
.desc = "Mismatched cache line size",
|
.desc = "Mismatched cache line size",
|
||||||
.capability = ARM64_MISMATCHED_CACHE_LINE_SIZE,
|
.capability = ARM64_MISMATCHED_CACHE_LINE_SIZE,
|
||||||
.matches = has_mismatched_cache_line_size,
|
.matches = has_mismatched_cache_type,
|
||||||
|
.type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
|
||||||
|
.cpu_enable = cpu_enable_trap_ctr_access,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.desc = "Mismatched cache type",
|
||||||
|
.capability = ARM64_MISMATCHED_CACHE_TYPE,
|
||||||
|
.matches = has_mismatched_cache_type,
|
||||||
.type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
|
.type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
|
||||||
.cpu_enable = cpu_enable_trap_ctr_access,
|
.cpu_enable = cpu_enable_trap_ctr_access,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user