Skip to content

Commit 4127112

Browse files
authored
Set the correct L2 size for Ampere Altra (aarch64).
1 parent cebb093 commit 4127112

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/arm/cache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,9 @@ void cpuinfo_arm_decode_cache(
13411341
* information, please refer to the technical manuals
13421342
* linked above
13431343
*/
1344-
const uint32_t min_l2_size_KB = uarch == cpuinfo_uarch_neoverse_v2 ? 1024 : 256;
1344+
const uint32_t min_l2_size_KB = uarch == cpuinfo_uarch_neoverse_v2 || midr_is_ampere_altra(midr)
1345+
? 1024
1346+
: 256;
13451347
const uint32_t min_l3_size_KB = 0;
13461348

13471349
*l1i = (struct cpuinfo_cache){

src/arm/midr.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define CPUINFO_ARM_MIDR_KRYO_SILVER_820 UINT32_C(0x510F2110)
3535
#define CPUINFO_ARM_MIDR_EXYNOS_M1_M2 UINT32_C(0x530F0010)
3636
#define CPUINFO_ARM_MIDR_DENVER2 UINT32_C(0x4E0F0030)
37+
#define CPUINFO_ARM_MIDR_AMPERE_ALTRA UINT32_C(0x413fd0c1)
3738

3839
inline static uint32_t midr_set_implementer(uint32_t midr, uint32_t implementer) {
3940
return (midr & ~CPUINFO_ARM_MIDR_IMPLEMENTER_MASK) |
@@ -167,6 +168,11 @@ inline static bool midr_is_kryo_gold(uint32_t midr) {
167168
return (midr & uarch_mask) == (CPUINFO_ARM_MIDR_KRYO_GOLD & uarch_mask);
168169
}
169170

171+
inline static bool midr_is_ampere_altra(uint32_t midr) {
172+
const uint32_t uarch_mask = CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK;
173+
return (midr & uarch_mask) == (CPUINFO_ARM_MIDR_AMPERE_ALTRA & uarch_mask);
174+
}
175+
170176
inline static uint32_t midr_score_core(uint32_t midr) {
171177
const uint32_t core_mask = CPUINFO_ARM_MIDR_IMPLEMENTER_MASK | CPUINFO_ARM_MIDR_PART_MASK;
172178
switch (midr & core_mask) {

0 commit comments

Comments
 (0)