Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions arch/arm64/kernel/pi/idreg-override.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ static const struct ftr_set_desc sw_features __prel64_initconst = {
},
};

static struct arm64_ftr_override __read_mostly aosc_feature_override;

static const struct ftr_set_desc aosc_features __prel64_initconst = {
.name = "aosc",
.override = &aosc_feature_override,
.fields = {
Comment on lines +218 to +223
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aosc_feature_override appears to be used only during early command-line parsing (to decide whether to auto-apply arm64.nompam on TSV110). Since it is not referenced after init_feature_override() completes, consider marking it __initdata (and dropping __read_mostly) so it can be freed with other init-only data instead of permanently occupying .data..read_mostly.

Copilot uses AI. Check for mistakes.
FIELD("try_mpam", 0, NULL),
{}
},
};

static const
PREL64(const struct ftr_set_desc, reg) regs[] __prel64_initconst = {
{ &mmfr0 },
Expand All @@ -226,6 +237,7 @@ PREL64(const struct ftr_set_desc, reg) regs[] __prel64_initconst = {
{ &isar2 },
{ &smfr0 },
{ &sw_features },
{ &aosc_features },
};

static const struct {
Expand Down Expand Up @@ -390,6 +402,27 @@ static __init void parse_cmdline(const void *fdt, int chosen)

if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && prop)
__parse_cmdline(prop, true);

/*
* Sorry but we have to work OotB on some platforms with broken
* firmware, notably W510. Use "aosc.try_mpam=1" if you really need
* MPAM on AOSC.
Comment on lines +407 to +409
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces a new boot parameter (aosc.try_mpam=1) that affects CPU feature enablement on TSV110, but it isn't documented in Documentation/admin-guide/kernel-parameters.txt (there are entries for arm64.nompam, etc.). Please add documentation for aosc.try_mpam so users can discover and understand the override and its default behavior.

Suggested change
* Sorry but we have to work OotB on some platforms with broken
* firmware, notably W510. Use "aosc.try_mpam=1" if you really need
* MPAM on AOSC.
* Some platforms (notably TSV110 / W510) ship with firmware that
* advertises MPAM but is not reliable enough for use out of the box.
*
* By default, for all CPUs in mpam_disable_list we forcibly disable
* MPAM early by injecting "arm64.nompam" into the effective
* command line (see the loop below).
*
* The "aosc.try_mpam=1" boot parameter provides an opt-in override
* for systems where the firmware is known to be good: when this
* parameter is present, arm64_apply_feature_override() will succeed
* and we will NOT add "arm64.nompam", so MPAM remains enabled.

Copilot uses AI. Check for mistakes.
Comment on lines +407 to +409
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment uses the abbreviation "OotB", which may be unclear to readers outside this context. Consider spelling this out (e.g., "out of the box") and tightening the wording to be more descriptive of the technical reason (firmware reports MPAM incorrectly on TSV110/W510) rather than apologetic.

Suggested change
* Sorry but we have to work OotB on some platforms with broken
* firmware, notably W510. Use "aosc.try_mpam=1" if you really need
* MPAM on AOSC.
* Disable MPAM by default on platforms with firmware that reports
* MPAM incorrectly, notably TSV110/W510. Use "aosc.try_mpam=1" if
* you really need MPAM on AOSC.

Copilot uses AI. Check for mistakes.
*/
static const struct midr_range mpam_disable_list[] __initconst = {
MIDR_ALL_VERSIONS(MIDR_HISI_TSV110),
{ /* sentinel */ }
};

for (const struct midr_range *r = mpam_disable_list; r->model; r++) {
if (midr_is_cpu_model_range(read_cpuid_id(), r->model,
r->rv_min, r->rv_max)) {
if (!arm64_apply_feature_override(0, 0, 4, &aosc_feature_override)) {
__parse_cmdline("arm64.nompam", true);
break;
}
}
}

}

void __init init_feature_override(u64 boot_status, const void *fdt,
Expand Down