Skip to content

perf(exerciser): poll DPC link recovery in a VAL helper - #675

Merged
chetan-rathore merged 2 commits into
ARM-software:mainfrom
cdwilde:perf/dpc-link-recovery-674
Nov 11, 2026
Merged

chetan-rathore merged 2 commits into
ARM-software:mainfrom
cdwilde:perf/dpc-link-recovery-674

Conversation

@cdwilde

@cdwilde cdwilde commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #674.

Summary

Replace the uncalibrated post-SBR spin and one-shot 100 ms link-recovery delay in e024 (PCI_ER_06) and e027 (PCI_ER_10) with bounded DLL Link Active polling, using a common VAL helper.

  • Add val_pcie_wait_for_link_up(bdf, timeout_ms) to val/src/acs_pcie.c. It checks link status immediately, then polls once per millisecond with val_time_delay_ms(ONE_MILLISECOND) for at most timeout_ms polls, returning as soon as the link is active. It does not read the architectural counter directly.
  • While waiting it logs "Link not yet active" at DEBUG. On timeout it logs "The link not active after reset" at ERROR, so the callers no longer print their own message. A failed delay is reported as an error.
  • If DLL Link Active reporting is not supported, the helper waits the full timeout and returns success, matching the previous behavior. e024 already fails such Root Ports before injecting errors, so this case only applies to e027.
  • Both tests use a 100 ms timeout. The SBR assertion hold, the post-link initialization delay in e024, both error-injection modes, configuration restoration and cleanup are unchanged.

Validation

  • Host tests of the extracted helper pass at -O0 and -O2 with -Wall -Wextra -Werror. The 8 cases cover:
    • already active
    • early recovery
    • recovery on the last poll
    • timeout
    • zero timeout
    • unsupported reporting
    • delay failure, before and during polling
  • Full SBSA baremetal build (-Werror) and complete suite run on a pre-silicon emulation platform. PCI_ER_06 passes across eight exerciser endpoints, and its elapsed simulated time drops from 331.1 ms to 172.3 ms. All 222 rule results match the baseline run.
  • PCI_ER_10 is not exercised on this platform, so e027 is covered by compilation and the helper tests only.

The emulation PAL scales delays, so the timing improvement should not be assumed to apply to other platforms.

Comment thread test_pool/exerciser/e024.c Outdated
if (status == PCIE_DLL_LINK_STATUS_ACTIVE)
return 0;

if (status != PCIE_DLL_LINK_STATUS_NOT_ACTIVE || elapsed == timeout_ticks)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At this point the status can be only PCIE_DLL_LINK_STATUS_ACTIVE or PCIE_DLL_LINK_STATUS_NOT_ACTIVE, So this condition becomes void.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. The helper no longer has that condition. It loops until the status is PCIE_DLL_LINK_STATUS_ACTIVE, and the unsupported case is handled once before the loop.

Comment thread test_pool/exerciser/e024.c Outdated
return 1;
}

start = ArmArchTimerReadReg(CntPct);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we avoid direct ArmArchTimerReadReg(CntPct) usage here and use a bounded val_time_delay_ms() based poll loop instead? That still fixes the busy-loop issue while keeping the exerciser test independent of architectural timer counter reads.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. val_pcie_wait_for_link_up() now polls with val_time_delay_ms(ONE_MILLISECOND) for at most timeout_ms polls, with no CntPct reads.

Comment thread test_pool/exerciser/e024.c Outdated
static uint32_t cfg_space_count;

static uint32_t
wait_for_link_up(uint32_t rp_bdf)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same logic needed in e027 as well. This can be in val so that both can use it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Added val_pcie_wait_for_link_up(bdf, timeout_ms) in val/src/acs_pcie.c, and e024 and e027 both use it. If Link Active reporting is not supported, it waits the full timeout and returns success, as e027 did before.

Comment thread test_pool/exerciser/e024.c Outdated
}
}

return 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Msg here that Link is not yet active

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added. Each retry logs "Link not yet active for BDF 0x%x, retrying" at DEBUG, and a timeout logs the error.

Comment thread test_pool/exerciser/e024.c Outdated
if (wait_for_link_up(erp_bdf))
{
val_print(ERROR,
"\n The link not active after reset for BDF 0x%x: ", erp_bdf);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be removed as the return from the wait_for_link_up

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed. The helper prints the link-down error, so e024 and e027 no longer print it.

@Sujana-M

Sujana-M commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Hi @cdwilde ,

Thank you for raising the PR. We have provided few comments, Request you to consider them.

Thanks,
Sujana
ACS Team

cdwilde and others added 2 commits November 5, 2026 06:52
Replace the uncalibrated post-SBR spin and one-shot link-up sleep with one-millisecond polling requests and a 100-millisecond architectural-counter deadline. Stop when DLL Link Active is observed within the recovery window; retain the SBR hold, post-link initialization delay, error-injection coverage and configuration restoration.

Fixes ARM-software#674.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 64fb407d-eb53-484a-bc49-606a91214662
Per review, add val_pcie_wait_for_link_up() and use it in e024 (PCI_ER_06)
and e027 (PCI_ER_10). It polls DLL Link Active once per millisecond with
val_time_delay_ms() for at most the given number of milliseconds, with no
direct architectural counter reads. When Link Active reporting is not
supported it waits the full timeout instead, as e027 previously did not
fail in that case. The helper reports the link-down error, so the
callers' duplicate message is removed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: aa96196c-fd99-476b-a579-8de0fe7f65e7
@cdwilde
cdwilde force-pushed the perf/dpc-link-recovery-674 branch from 670e140 to 6dfabd0 Compare November 5, 2026 18:36
@cdwilde cdwilde changed the title perf(exerciser): poll DPC link recovery with a counter deadline perf(exerciser): poll DPC link recovery in a VAL helper Nov 5, 2026
@cdwilde

cdwilde commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Sujana-M. I've addressed all five comments in 6dfabd0, rebased on main. The link-up polling is now a VAL helper used by both e024 and e027. Validation is in the updated description: host tests of the helper, plus a full SBSA suite run on our emulation platform where PCI_ER_06 still passes and all rule results are unchanged.

@chetan-rathore
chetan-rathore merged commit da6fa03 into ARM-software:main Nov 11, 2026
29 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.

PCI_ER_06: replace coarse DPC link-recovery waits with bounded polling

3 participants