Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opentitantool] Ship updated firmware for HyperDebug #25917

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

jesultra
Copy link
Contributor

@jesultra jesultra commented Jan 17, 2025

Support 48Mhz clock generation, and bugfixes

Add ability to change HyperDebug core clock frequency. Choosing 96 MHz will allow any PWM capable pin to produce a 48 MHz clock suitable for driving a NuvoTitan chip. (CN10.31 is the only pin that can output 96 MHz.)

Also included are a few bugfixes to HyperDebug polling the "GSC ready" signal when passing through TPM operations.

Relevant CLs:
d090a07063 chip/stm32: Avoid stuck UART to USB forwarding
b3c959b5c5 board/hyperdebug: Avoid clobbering CCR_CFGR register
765b8a9d2b chip/stm32: Wait for core voltage to stabilize on STM32L4/5
6e9f274d2c board/hyperdebug: Improve GSC ready pulse detection
843d7ee9a6 board/hyperdebug: Expect GSC ready pulse after transaction
1b9f351528 board/hyperdebug: Properly set system timer tick rate
3962928140 board/hyperdebug: Allow runtime changes to system clock
821e9349d2 chip/stm32: Consolidate clock enums
e7f8842e93 chip/stm32: Rename STM32_HSE_CLOCK to CONFIG_STM32_CLOCK_HSE_HZ
a8fc0258fe board/hyperdebug: Fast clock output on CN10.31
6265770002 board/hyperdebug: Add support for PWM via low power timers
195271c11d board/hyperdebug: Refactor PWM
fbf583383f board/hyperdebug: Fix off-by-one and rounding errors

@jesultra jesultra added SW:opentitantool CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 labels Jan 17, 2025
@jesultra jesultra requested a review from cfrantz as a code owner January 17, 2025 05:12
@jesultra jesultra force-pushed the hyperdebug_firmware branch from 3c53d5b to 6a3b1b7 Compare January 17, 2025 05:17
@jesultra jesultra force-pushed the hyperdebug_firmware branch from 6a3b1b7 to 0a4091d Compare January 17, 2025 16:50
@jesultra jesultra marked this pull request as draft January 18, 2025 20:00
@jesultra
Copy link
Contributor Author

I suspect that this firmware is unstable, as it seems HyperDebug restarted during CI testing.

This is unfortunate, since OpenTitanTool will not automatically downgrade firmware, so now the affected CI machines have faulty HyperDebug firmware which will affect other "innocent" PRs. I have created PR #25934 to make OpenTitanTool automatically downgrade.

jesultra added a commit to jesultra/opentitan that referenced this pull request Jan 18, 2025
This reverts commit 7a0134a, such that
opentitantool no longer requires the `--force` switch in order to
downgrade firmware with `opentitantool transport update-firmware`.
Instead, opentitantool will be back to the original behavior of
overwriting firmware in any case when the version number does not match
exactly.

The original reason for not downgrading was that our branches had
diverged, such that they had different firmware versions, resulting in
CI machines constantly upgrading/downgrading as CI runs from different
branches were scheduled.

PR lowRISC#25917, however introduced a faulty HyperDebug firmware with never
version number, which is now on a number of CI machines, and will not be
downgraded automatically, with the result that "innocent" other PRs will
have CI failures.

I think it is clear that we should avoid such excessive flashing by
keeping the HyperDebug firmware version in sync between branches.  (We
do not need to keep all of opentitantool logic in sync, just the
built-in firmware version.)  For now, in order to avoid CI failures, we
should merge this PR, and accept some upgrading/downgrading.

Change-Id: I57739777ab3d86fa7e0375834cf9140e8e6ac984
Signed-off-by: Jes B. Klinke <[email protected]>
jesultra added a commit that referenced this pull request Jan 18, 2025
This reverts commit 7a0134a, such that
opentitantool no longer requires the `--force` switch in order to
downgrade firmware with `opentitantool transport update-firmware`.
Instead, opentitantool will be back to the original behavior of
overwriting firmware in any case when the version number does not match
exactly.

The original reason for not downgrading was that our branches had
diverged, such that they had different firmware versions, resulting in
CI machines constantly upgrading/downgrading as CI runs from different
branches were scheduled.

PR #25917, however introduced a faulty HyperDebug firmware with never
version number, which is now on a number of CI machines, and will not be
downgraded automatically, with the result that "innocent" other PRs will
have CI failures.

I think it is clear that we should avoid such excessive flashing by
keeping the HyperDebug firmware version in sync between branches.  (We
do not need to keep all of opentitantool logic in sync, just the
built-in firmware version.)  For now, in order to avoid CI failures, we
should merge this PR, and accept some upgrading/downgrading.

Change-Id: I57739777ab3d86fa7e0375834cf9140e8e6ac984
Signed-off-by: Jes B. Klinke <[email protected]>
github-actions bot pushed a commit that referenced this pull request Jan 18, 2025
This reverts commit 7a0134a, such that
opentitantool no longer requires the `--force` switch in order to
downgrade firmware with `opentitantool transport update-firmware`.
Instead, opentitantool will be back to the original behavior of
overwriting firmware in any case when the version number does not match
exactly.

The original reason for not downgrading was that our branches had
diverged, such that they had different firmware versions, resulting in
CI machines constantly upgrading/downgrading as CI runs from different
branches were scheduled.

PR #25917, however introduced a faulty HyperDebug firmware with never
version number, which is now on a number of CI machines, and will not be
downgraded automatically, with the result that "innocent" other PRs will
have CI failures.

I think it is clear that we should avoid such excessive flashing by
keeping the HyperDebug firmware version in sync between branches.  (We
do not need to keep all of opentitantool logic in sync, just the
built-in firmware version.)  For now, in order to avoid CI failures, we
should merge this PR, and accept some upgrading/downgrading.

Change-Id: I57739777ab3d86fa7e0375834cf9140e8e6ac984
Signed-off-by: Jes B. Klinke <[email protected]>
(cherry picked from commit 2667a3a)
github-actions bot pushed a commit that referenced this pull request Jan 18, 2025
This reverts commit 7a0134a, such that
opentitantool no longer requires the `--force` switch in order to
downgrade firmware with `opentitantool transport update-firmware`.
Instead, opentitantool will be back to the original behavior of
overwriting firmware in any case when the version number does not match
exactly.

The original reason for not downgrading was that our branches had
diverged, such that they had different firmware versions, resulting in
CI machines constantly upgrading/downgrading as CI runs from different
branches were scheduled.

PR #25917, however introduced a faulty HyperDebug firmware with never
version number, which is now on a number of CI machines, and will not be
downgraded automatically, with the result that "innocent" other PRs will
have CI failures.

I think it is clear that we should avoid such excessive flashing by
keeping the HyperDebug firmware version in sync between branches.  (We
do not need to keep all of opentitantool logic in sync, just the
built-in firmware version.)  For now, in order to avoid CI failures, we
should merge this PR, and accept some upgrading/downgrading.

Change-Id: I57739777ab3d86fa7e0375834cf9140e8e6ac984
Signed-off-by: Jes B. Klinke <[email protected]>
(cherry picked from commit 2667a3a)
@jesultra jesultra force-pushed the hyperdebug_firmware branch from 0a4091d to 77bbccb Compare January 29, 2025 16:04
Support 48Mhz clock generation, and bugfixes

Add ability to change HyperDebug core clock frequency.  Choosing 96 MHz
will allow any PWM capable pin to produce a 48 MHz clock suitable for
driving a NuvoTitan chip.  (CN10.31 is the only pin that can output 96
MHz.)

Also included are a few bugfixes to HyperDebug polling the "GSC ready"
signal when passing through TPM operations.

Relevant CLs:
d090a07063 chip/stm32: Avoid stuck UART to USB forwarding
b3c959b5c5 board/hyperdebug: Avoid clobbering CCR_CFGR register
765b8a9d2b chip/stm32: Wait for core voltage to stabilize on STM32L4/5
6e9f274d2c board/hyperdebug: Improve GSC ready pulse detection
843d7ee9a6 board/hyperdebug: Expect GSC ready pulse after transaction
1b9f351528 board/hyperdebug: Properly set system timer tick rate
3962928140 board/hyperdebug: Allow runtime changes to system clock
821e9349d2 chip/stm32: Consolidate clock enums
e7f8842e93 chip/stm32: Rename STM32_HSE_CLOCK to CONFIG_STM32_CLOCK_HSE_HZ
a8fc0258fe board/hyperdebug: Fast clock output on CN10.31
6265770002 board/hyperdebug: Add support for PWM via low power timers
195271c11d board/hyperdebug: Refactor PWM
fbf583383f board/hyperdebug: Fix off-by-one and rounding errors

Signed-off-by: Jes B. Klinke <[email protected]>
Change-Id: I212c1a249249470601d667a72b29244f26bcd6c5
@jesultra jesultra force-pushed the hyperdebug_firmware branch from 77bbccb to 8c999f9 Compare January 31, 2025 21:25
@jesultra
Copy link
Contributor Author

The cause of the HyperDebug crashes in CI has been identified, https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/6219337 .

If the pending CI run goes well, I plan on merging this.

@jesultra jesultra marked this pull request as ready for review January 31, 2025 21:29
@jesultra jesultra merged commit a9e85dc into lowRISC:master Feb 1, 2025
38 checks passed
Copy link

github-actions bot commented Feb 1, 2025

Backport failed for earlgrey_es_sival, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin earlgrey_es_sival
git worktree add -d .worktree/backport-25917-to-earlgrey_es_sival origin/earlgrey_es_sival
cd .worktree/backport-25917-to-earlgrey_es_sival
git switch --create backport-25917-to-earlgrey_es_sival
git cherry-pick -x 8c999f9e6d117ee717d96dd8fcec81cf2da3752c

Copy link

github-actions bot commented Feb 1, 2025

Backport failed for earlgrey_1.0.0, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin earlgrey_1.0.0
git worktree add -d .worktree/backport-25917-to-earlgrey_1.0.0 origin/earlgrey_1.0.0
cd .worktree/backport-25917-to-earlgrey_1.0.0
git switch --create backport-25917-to-earlgrey_1.0.0
git cherry-pick -x 8c999f9e6d117ee717d96dd8fcec81cf2da3752c

@github-actions github-actions bot added the Manually CherryPick This PR should be manually cherry picked. label Feb 1, 2025
@jesultra jesultra deleted the hyperdebug_firmware branch February 10, 2025 04:48
@jesultra
Copy link
Contributor Author

In an attempt to avoid repeated upgrading/downgrading of HyperDebug firmware in CI, I have created PR #26383 and PR #26384 to backports to earlgrey_es_sival and earlgrey_1.0.0.

If there are other branches regularly being run on CI, I would need to ensure that those have the same version as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 Manually CherryPick This PR should be manually cherry picked. SW:opentitantool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants