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

target/riscv: reset delays during batch scans #1028

Merged
merged 1 commit into from
May 2, 2024

Commits on Apr 26, 2024

  1. target/riscv: reset delays during batch scans

    This commit is related to testing how OpenOCD responds to `dmi.busy`.
    
    Consider testing on Spike (e.g. `riscv-tests/debug` testsuite). Spike
    returns `dmi.busy` if there were less then a given number of RTI cycles
    (`required_rti_cycles`) between DR_UPDATE and DR_CAPTURE:
    https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/jtag_dtm.cc#L145
    https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/jtag_dtm.cc#L202
    `required_rti_cycles` gets it's value from `--dmi-rti` CLI argument and
    is constant throughout the run.
    
    OpenOCD learns this required number of RTI cycles by starting with zero
    and increasing it if `dmi.busy` is encountered. So the required number
    of RTI cycles is learned during the first DMI access in the `examine()`.
    
    To induce `dmi.busy` on demand `riscv reset_delays <x>` command is
    provided. This command initializes `riscv_info::reset_delays_wait`
    counter to the provided `<x>` value. The counter is decreased before a
    DMI access and when it reaches zero the learned value of RTI cycles
    required is reset, so the DMI access results in `dmi.busy`.
    
    Now consider running a batch of accesses.  Before the change all the
    accesses in the batch had the same number of RIT cycles in between them.
    So either:
    * Number of accesses in the batch was greater then the value of
      `riscv_info::reset_delays_wait` counter and there was no `dmi.busy`
    throughout the batch.
    * Number of accesses in the batch was less or equal then the value of
      `riscv_info::reset_delays_wait` counter and the first access of the
    batch resulted in `dmi.busy`.
    
    Therefore it was impossible to encounter `dmi.busy` on any scan of the
    batch except the first one.
    
    Change-Id: Ib0714ecaf7d2e11878140d16d9aa6152ff20f1e9
    Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
    en-sc committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    68fcd1c View commit details
    Browse the repository at this point in the history