Skip to content

DMI busy is mishandled on Microchip PolarFire SoC #1307

@en-sc

Description

@en-sc

The issue is discovered by @tom-van and can be reproduced by running:

> poll off
> reg a0 0x123456789abcdef
a0 (/64): 0x0123456789abcdef
> step
[mpfs.e51] Found 10 triggers
mpfs.e51 halted due to single-step.
> reg a0
a0 (/64): 0x0123456789abcdef
> step
mpfs.e51 halted due to single-step.

> riscv reset_delays 1
> debug_level 3
> reg a0
a0 (/64): 0x0123456700000000

That results in:

Debug: 2605 479333 target.c:3031 handle_reg_command(): -
Debug: 2606 479333 riscv_reg.c:979 riscv_reg_get(): [mpfs.e51] Reading a0 from target
Debug: 2607 479333 riscv-013.c:5126 riscv013_get_register(): [mpfs.e51] reading register a0
Debug: 2608 479333 riscv-013.c:1636 register_read_direct(): [mpfs.e51] Reading a0
Debug: 2609 479333 riscv-013.c:748 riscv013_execute_abstract_command(): [mpfs.e51] access register=0x32100a {regno=0x100a write=arg0 transfer=enabled postexec=disabled aarpostincrement=disabled aarsize=64bit}
Debug: 2610 479333 batch.c:291 riscv_batch_run_from(): [mpfs.e51] Running batch of scans [0, 3)
Debug: 2611 479333 batch.c:255 log_batch(): 41b w 0032100a @17 -> + 00000000 @00; 3i
Debug: 2612 479333 batch.c:199 log_dmi_decoded(): write: command=0x32100a {control=0x32100a}
Debug: 2613 479333 batch.c:255 log_batch(): 41b r 00000000 @16 -> + 00331008 @17; 0i
Debug: 2614 479333 batch.c:255 log_batch(): 41b - 00000000 @00 -> b 00000000 @00; 0i
Debug: 2615 479333 riscv-013.c:474 decrement_reset_delays_counter(): [mpfs.e51] resetting learned delays (reset_delays_wait counter expired)
Debug: 2616 479333 riscv.c:451 dtmcs_scan(): TAP mpfs.cpu: DTMCS: 0x10000 -> ?
Debug: 2617 479333 batch.h:86 riscv_scan_set_delay(): DM access delay is set to 1.
Debug: 2618 479333 batch.c:139 add_idle_before_batch(): [mpfs.e51] Adding 1 idle cycles before the batch.
Debug: 2619 479333 batch.c:291 riscv_batch_run_from(): [mpfs.e51] Running batch of scans [2, 3)
Debug: 2620 479333 batch.c:255 log_batch(): 41b - 00000000 @00 -> + 10000002 @16; 1i
Debug: 2621 479333 batch.c:199 log_dmi_decoded(): read: abstractcs=0x10000002 {datacount=2 progbufsize=0x10}
Debug: 2622 479333 riscv-013.c:683 abstract_cmd_batch_check_and_clear_cmderr(): [mpfs.e51] abstractcs=0x10000002 {datacount=2 relaxedpriv=full_checks busy=ready progbufsize=0x10 cmderr=none}
Debug: 2623 479333 batch.c:291 riscv_batch_run_from(): [mpfs.e51] Running batch of scans [0, 3)
Debug: 2624 479333 batch.c:255 log_batch(): 41b r 00000000 @04 -> + 00000000 @00; 1i
Debug: 2625 479333 batch.c:255 log_batch(): 41b r 00000000 @05 -> b 00000000 @00; 1i
Debug: 2626 479333 batch.c:255 log_batch(): 41b - 00000000 @00 -> b 00000000 @00; 1i
Debug: 2627 479333 riscv.c:451 dtmcs_scan(): TAP mpfs.cpu: DTMCS: 0x10000 -> ?
Debug: 2628 479333 batch.h:86 riscv_scan_set_delay(): DM access delay is set to 2.
Debug: 2629 479333 batch.c:139 add_idle_before_batch(): [mpfs.e51] Adding 1 idle cycles before the batch.
Debug: 2630 479333 batch.c:291 riscv_batch_run_from(): [mpfs.e51] Running batch of scans [1, 3)
Debug: 2631 479334 batch.c:255 log_batch(): 41b r 00000000 @05 -> + 00000000 @00; 2i
Debug: 2632 479334 batch.c:199 log_dmi_decoded(): read:
Debug: 2633 479334 batch.c:255 log_batch(): 41b - 00000000 @00 -> b 00000000 @00; 2i
Debug: 2634 479334 riscv.c:451 dtmcs_scan(): TAP mpfs.cpu: DTMCS: 0x10000 -> ?
Debug: 2635 479334 batch.h:86 riscv_scan_set_delay(): DM access delay is set to 3.
Debug: 2636 479334 batch.c:139 add_idle_before_batch(): [mpfs.e51] Adding 1 idle cycles before the batch.
Debug: 2637 479334 batch.c:291 riscv_batch_run_from(): [mpfs.e51] Running batch of scans [2, 3)
Debug: 2638 479334 batch.c:255 log_batch(): 41b - 00000000 @00 -> + 01234567 @05; 3i
Debug: 2639 479334 batch.c:199 log_dmi_decoded(): read:
Debug: 2640 479334 riscv-013.c:1655 register_read_direct(): [mpfs.e51] a0 = 0x123456700000000
Debug: 2641 479334 riscv_reg.c:988 riscv_reg_get(): [mpfs.e51] Read a0: 0x123456700000000
Debug: 2642 479334 riscv-013_reg.c:40 riscv013_reg_get(): [mpfs.e51] Read 0x0123456700000000 from a0 (valid=1).

The data0 read returns zeroes resulting in the lower half of the a0 register reported as zeroes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions