2024-02-09 17:11:40

by Robin Murphy

[permalink] [raw]
Subject: [PATCH v2] perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count)

From: Ilkka Koskinen <[email protected]>

AmpereOneX mesh implementation has a bug in HN-P nodes that makes them
report incorrect child count. The failing crosspoints report 8 children
while they only have two.

When the driver tries to access the inexistent child nodes, it believes it
has reached an invalid node type and probing fails. The workaround is to
ignore those incorrect child nodes and continue normally.

Signed-off-by: Ilkka Koskinen <[email protected]>
[ rm: rewrote simpler generalised version ]
Tested-by: Ilkka Koskinen <[email protected]>
Signed-off-by: Robin Murphy <[email protected]>
---
drivers/perf/arm-cmn.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index c584165b13ba..7e3aa7e2345f 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2305,6 +2305,17 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
dev_dbg(cmn->dev, "ignoring external node %llx\n", reg);
continue;
}
+ /*
+ * AmpereOneX erratum AC04_MESH_1 makes some XPs report a bogus
+ * child count larger than the number of valid child pointers.
+ * A child offset of 0 can only occur on CMN-600; otherwise it
+ * would imply the root node being its own grandchild, which
+ * we can safely dismiss in general.
+ */
+ if (reg == 0 && cmn->part != PART_CMN600) {
+ dev_dbg(cmn->dev, "bogus child pointer?\n");
+ continue;
+ }

arm_cmn_init_node_info(cmn, reg & CMN_CHILD_NODE_ADDR, dn);

--
2.39.2.101.g768bb238c484.dirty



2024-02-09 18:32:22

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH v2] perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count)

On Fri, 9 Feb 2024 17:11:09 +0000, Robin Murphy wrote:
> From: Ilkka Koskinen <[email protected]>
>
> AmpereOneX mesh implementation has a bug in HN-P nodes that makes them
> report incorrect child count. The failing crosspoints report 8 children
> while they only have two.
>
> When the driver tries to access the inexistent child nodes, it believes it
> has reached an invalid node type and probing fails. The workaround is to
> ignore those incorrect child nodes and continue normally.
>
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count)
https://git.kernel.org/arm64/c/50572064ec71

Cheers,
--
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev