forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bits/220-tso' into asahi-wip
- Loading branch information
Showing
15 changed files
with
241 additions
and
6 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
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,61 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Contains implementation-defined CPU feature definitions. | ||
*/ | ||
|
||
#include <asm/cpufeature.h> | ||
#include <asm/apple_cpufeature.h> | ||
|
||
#ifdef CONFIG_ARM64_MEMORY_MODEL_CONTROL | ||
static 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 cpufeature_matches(val, entry); | ||
} | ||
|
||
static 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); | ||
} | ||
#endif | ||
|
||
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_cpucap_indirect_list_impdef(void) | ||
{ | ||
init_cpucap_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef __ASM_MEMORY_ORDERING_MODEL_H | ||
#define __ASM_MEMORY_ORDERING_MODEL_H | ||
|
||
/* Arch hooks to implement the PR_{GET_SET}_MEM_MODEL prctls */ | ||
|
||
struct task_struct; | ||
int arch_prctl_mem_model_get(struct task_struct *t); | ||
int arch_prctl_mem_model_set(struct task_struct *t, unsigned long val); | ||
|
||
#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
Oops, something went wrong.