Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit d16b5e0

Browse files
author
ALTracer
committed
hosted/remote/protocol_v4_riscv: Adjust DMI idle cycles for remote "Too soon" responses
1 parent a523f16 commit d16b5e0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/platforms/hosted/remote/protocol_v4_riscv.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,15 @@ bool remote_v4_riscv_check_error(
5151
const uint64_t response_code = remote_decode_response(buffer + 1, (size_t)length - 1U);
5252
const uint8_t error = response_code & 0xffU;
5353
/* If the error part of the response code indicates a fault, store the fault value */
54-
if (error == REMOTE_ERROR_FAULT)
54+
if (error == REMOTE_ERROR_FAULT) {
5555
dmi->fault = response_code >> 8U;
56+
/*
57+
* If we got RV_DMI_TOO_SOON and we're under 8 idle cycles, increase the number
58+
* of idle cycles used to compensate and have the outer code re-run the transfers
59+
*/
60+
if (dmi->fault == RV_DMI_TOO_SOON && dmi->idle_cycles < 8U)
61+
++dmi->idle_cycles;
62+
}
5663
/* If the error part indicates an exception had occurred, make that happen here too */
5764
else if (error == REMOTE_ERROR_EXCEPTION)
5865
raise_exception(response_code >> 8U, "Remote protocol exception");
@@ -65,6 +72,8 @@ bool remote_v4_riscv_check_error(
6572
/* Check if the firmware is reporting some other kind of error */
6673
else if (buffer[0U] != REMOTE_RESP_OK)
6774
DEBUG_ERROR("%s: Firmware reported unexpected error: %c\n", func, buffer[0]);
75+
else
76+
dmi->fault = RV_DMI_SUCCESS;
6877
/* Return whether the remote indicated the request was successful */
6978
return buffer[0U] == REMOTE_RESP_OK;
7079
}

0 commit comments

Comments
 (0)