forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/bits/220-tso' into asahi-wip
- Loading branch information
Showing
12 changed files
with
202 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
|
||
#ifndef __ASM_APPLE_CPUFEATURES_H | ||
#define __ASM_APPLE_CPUFEATURES_H | ||
|
||
#include <linux/bits.h> | ||
#include <asm/sysreg.h> | ||
|
||
#define AIDR_APPLE_TSO_SHIFT 9 | ||
#define AIDR_APPLE_TSO BIT(9) | ||
|
||
#define ACTLR_APPLE_TSO_SHIFT 1 | ||
#define ACTLR_APPLE_TSO BIT(1) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Contains implementation-defined CPU feature definitions. | ||
*/ | ||
|
||
#include <asm/cpufeature.h> | ||
#include <asm/apple_cpufeature.h> | ||
|
||
void __init init_cpu_hwcaps_indirect_list_from_array(const struct arm64_cpu_capabilities *caps); | ||
bool feature_matches(u64 reg, const struct arm64_cpu_capabilities *entry); | ||
|
||
bool has_apple_feature(const struct arm64_cpu_capabilities *entry, int scope) | ||
{ | ||
u64 val; | ||
WARN_ON(scope != SCOPE_SYSTEM); | ||
|
||
if (read_cpuid_implementor() != ARM_CPU_IMP_APPLE) | ||
return false; | ||
|
||
val = read_sysreg(aidr_el1); | ||
return feature_matches(val, entry); | ||
} | ||
|
||
bool has_tso_fixed(const struct arm64_cpu_capabilities *entry, int scope) | ||
{ | ||
/* List of CPUs that always use the TSO memory model */ | ||
static const struct midr_range fixed_tso_list[] = { | ||
MIDR_ALL_VERSIONS(MIDR_NVIDIA_DENVER), | ||
MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL), | ||
MIDR_ALL_VERSIONS(MIDR_FUJITSU_A64FX), | ||
{ /* sentinel */ } | ||
}; | ||
|
||
return is_midr_in_range_list(read_cpuid_id(), fixed_tso_list); | ||
} | ||
|
||
static const struct arm64_cpu_capabilities arm64_impdef_features[] = { | ||
#ifdef CONFIG_ARM64_MEMORY_MODEL_CONTROL | ||
{ | ||
.desc = "TSO memory model (Apple)", | ||
.capability = ARM64_HAS_TSO_APPLE, | ||
.type = ARM64_CPUCAP_SYSTEM_FEATURE, | ||
.matches = has_apple_feature, | ||
.field_pos = AIDR_APPLE_TSO_SHIFT, | ||
.field_width = 1, | ||
.sign = FTR_UNSIGNED, | ||
.min_field_value = 1, | ||
}, | ||
{ | ||
.desc = "TSO memory model (Fixed)", | ||
.capability = ARM64_HAS_TSO_FIXED, | ||
.type = ARM64_CPUCAP_SYSTEM_FEATURE, | ||
.matches = has_tso_fixed, | ||
}, | ||
#endif | ||
{}, | ||
}; | ||
|
||
void __init init_cpu_hwcaps_indirect_list_impdef(void) | ||
{ | ||
init_cpu_hwcaps_indirect_list_from_array(arm64_impdef_features); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@marcan is this the reason why TSO is disabled after execve? It would be nice if it remains enabled...