|
16 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | */ |
18 | 18 |
|
| 19 | +#include <linux/arm-smccc.h> |
| 20 | +#include <linux/psci.h> |
19 | 21 | #include <linux/types.h> |
20 | 22 | #include <asm/cpu.h> |
21 | 23 | #include <asm/cputype.h> |
@@ -45,12 +47,18 @@ is_kryo_midr(const struct arm64_cpu_capabilities *entry, int scope) |
45 | 47 | } |
46 | 48 |
|
47 | 49 | static bool |
48 | | -has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry, |
49 | | - int scope) |
| 50 | +has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry, |
| 51 | + int scope) |
50 | 52 | { |
| 53 | + u64 mask = CTR_CACHE_MINLINE_MASK; |
| 54 | + |
| 55 | + /* Skip matching the min line sizes for cache type check */ |
| 56 | + if (entry->capability == ARM64_MISMATCHED_CACHE_TYPE) |
| 57 | + mask ^= arm64_ftr_reg_ctrel0.strict_mask; |
| 58 | + |
51 | 59 | WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); |
52 | | - return (read_cpuid_cachetype() & arm64_ftr_reg_ctrel0.strict_mask) != |
53 | | - (arm64_ftr_reg_ctrel0.sys_val & arm64_ftr_reg_ctrel0.strict_mask); |
| 60 | + return (read_cpuid_cachetype() & mask) != |
| 61 | + (arm64_ftr_reg_ctrel0.sys_val & mask); |
54 | 62 | } |
55 | 63 |
|
56 | 64 | static int cpu_enable_trap_ctr_access(void *__unused) |
@@ -511,7 +519,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { |
511 | 519 | { |
512 | 520 | .desc = "Mismatched cache line size", |
513 | 521 | .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE, |
514 | | - .matches = has_mismatched_cache_line_size, |
| 522 | + .matches = has_mismatched_cache_type, |
| 523 | + .def_scope = SCOPE_LOCAL_CPU, |
| 524 | + .enable = cpu_enable_trap_ctr_access, |
| 525 | + }, |
| 526 | + { |
| 527 | + .desc = "Mismatched cache type", |
| 528 | + .capability = ARM64_MISMATCHED_CACHE_TYPE, |
| 529 | + .matches = has_mismatched_cache_type, |
515 | 530 | .def_scope = SCOPE_LOCAL_CPU, |
516 | 531 | .enable = cpu_enable_trap_ctr_access, |
517 | 532 | }, |
|
0 commit comments