Skip to content

Commit

Permalink
plat-k3: drivers: Add check for host ID as well in ti_sci_get_response
Browse files Browse the repository at this point in the history
It could be helpful in cases where we get response from some different
host that had sent the message before op-tee started but op-tee ended up
receiving the message.

Signed-off-by: Manorit Chawdhry <[email protected]>
  • Loading branch information
manorit2001 committed Oct 29, 2024
1 parent 5336f69 commit e88be30
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions core/arch/arm/plat-k3/drivers/ti_sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,20 @@ static inline int ti_sci_get_response(struct ti_sci_xfer *xfer)
hdr = (struct ti_sci_msg_hdr *)msg->buf;

/* Sanity check for message response */
if (hdr->seq == message_sequence)
break;
if (hdr->seq != message_sequence) {
EMSG("Message with sequence ID %u not expected",
hdr->seq);
ret = TEE_ERROR_CORRUPT_OBJECT;
}

if (hdr->host != OPTEE_HOST_ID) {
EMSG("Message with Host ID %u not expected",
hdr->host);
ret = TEE_ERROR_CORRUPT_OBJECT;
}

IMSG("Message with sequence ID %u is not expected", hdr->seq);
if (!ret)
break;
}
if (!retry) {
EMSG("Timed out waiting for message");
Expand All @@ -122,7 +132,7 @@ static inline int ti_sci_get_response(struct ti_sci_xfer *xfer)
return TEE_ERROR_ACCESS_DENIED;
}

return 0;
return ret;
}

/**
Expand Down

0 comments on commit e88be30

Please sign in to comment.