Skip to content

[RTL] Pinmux jtag muxing#30707

Open
gautschimi wants to merge 1 commit into
lowRISC:masterfrom
gautschimi:pinmux_jtag_muxing
Open

[RTL] Pinmux jtag muxing#30707
gautschimi wants to merge 1 commit into
lowRISC:masterfrom
gautschimi:pinmux_jtag_muxing

Conversation

@gautschimi

@gautschimi gautschimi commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The jtag tck and trst were muxed with a combinatorial process. This can potentially lead to glitches on the clock lines and lead to failures during jtag transactions. e.g. mess up the jtag statemachine. This could be an explanation for some of the CI failures we see (e.g. the errors described in this issue #29555). We need to observe CI a bit to see if it really helps.

The fix is:

  • only mux tms and tdi (data signals) in the combinatorial process
  • Add a single bit Flop for each muxed jtag (rv, lc, dft) to disable the clock and reset with an AND gate

This fix is similar to the fix that has been done for the bkdr loader (f5668d8)

Security:

  • TCK, and TRSTN are now gated with a single bit register which makes it easier to for fault injection to reenable the jtag clock. But TMS, TDI, TDO are still gated or muxed the same way. Hence, I think the level of security is the same.

@gautschimi gautschimi force-pushed the pinmux_jtag_muxing branch 3 times, most recently from ee2f225 to 21ad2e2 Compare July 10, 2026 07:28
@gautschimi gautschimi self-assigned this Jul 10, 2026
@gautschimi

Copy link
Copy Markdown
Contributor Author

see #29555

@glaserf

glaserf commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for this PR, this could indeed be a smoking gun, very nice catch! I'll yet have to review the changes in detail, but one comment in regards to LINT: The earlgrey chiplevel check fails with

E   CLOCK_DRIVER:   pinmux_jtag_buf.sv:18       'tck_gated' is driven by instance 'u_prim_and2_tck' of module 'prim_and2', and used as a clock 'tck_i' at dmi_jtag_tap.sv:104

Even though you added a waiver to pinmux (which acts on this message but a different signal/net). This therefore either needs to be adapted or extended.

Comment thread hw/top_earlgrey/ip_autogen/pinmux/rtl/pinmux_strap_sampling.sv Outdated

@vogelpi vogelpi left a comment

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.

Thanks @gautschimi , this looks good to me.

We should also also discuss this with partners before merging. About the security aspect: if really needed, we could also add a consistency check for the 3 added flops to only allow for a mismatch during one clock cycle and wire that up with the fatal alert of pinmux.

@gautschimi gautschimi force-pushed the pinmux_jtag_muxing branch 3 times, most recently from 4a9ef32 to db88664 Compare July 10, 2026 11:51
@gautschimi

Copy link
Copy Markdown
Contributor Author

ok all tests have passed with this bitstream. not so bad.

Locally I still see flaky tests with sram execution. but I think that is another problem

The three jtag request (lc_jtag, dft_jtag, rv_jtag) are now gated with
an AND-gate instead of a combinatorial process. This eliminates the risk
of a glitch on the jtag clock or reset line.

Signed-off-by: Michael Gautschi <mgautschi@lowrisc.org>
@gautschimi gautschimi force-pushed the pinmux_jtag_muxing branch from db88664 to be7bd57 Compare July 10, 2026 14:19
@gautschimi gautschimi marked this pull request as ready for review July 10, 2026 14:34
@gautschimi gautschimi requested a review from msfschaffner July 13, 2026 07:19
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.

3 participants