Skip to content

platform: xuantie: Harden xuantie link pmu init#10

Merged
cp0613 merged 1 commit into
XUANTIE-RV:opensbi-v1.7-devfrom
cp0613:opensbi-v1.7-dev
Jun 1, 2026
Merged

platform: xuantie: Harden xuantie link pmu init#10
cp0613 merged 1 commit into
XUANTIE-RV:opensbi-v1.7-devfrom
cp0613:opensbi-v1.7-dev

Conversation

@cp0613
Copy link
Copy Markdown
Collaborator

@cp0613 cp0613 commented Jun 1, 2026

Several robustness fixes in xuantie_link_pmu_device_init():

  • Use >= 0 to validate fdt_node_offset_by_compatible() result; the previous > 0 check would miss a node at offset 0.
  • Iterate all instances of each PMU compatible instead of only the first one, so multi-cluster SoCs initialise every L3 PMU.
  • Skip nodes with status = "disabled" via fdt_node_is_enabled().
  • Default-inhibit all counters (matches the kernel driver probe behaviour) so counters do not free-run between OpenSBI and kernel handoff.
  • Replace magic numbers with named macros (CNT_BITMAP, AUTHCR_AUTH, AUTHCR_INTPEND).
  • Bail out early if fdt_get_address_rw() returns NULL.

Several robustness fixes in xuantie_link_pmu_device_init():

- Use `>= 0` to validate fdt_node_offset_by_compatible() result; the
  previous `> 0` check would miss a node at offset 0.
- Iterate all instances of each PMU compatible instead of only the
  first one, so multi-cluster SoCs initialise every L3 PMU.
- Skip nodes with status = "disabled" via fdt_node_is_enabled().
- Default-inhibit all counters (matches the kernel driver probe
  behaviour) so counters do not free-run between OpenSBI and kernel
  handoff.
- Replace magic numbers with named macros (CNT_BITMAP, AUTHCR_AUTH,
  AUTHCR_INTPEND).
- Bail out early if fdt_get_address_rw() returns NULL.

Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
@cp0613 cp0613 merged commit 12f1c0a into XUANTIE-RV:opensbi-v1.7-dev Jun 1, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant