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

plat-k3: Add locks for TI-SCI protocol #7089

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions core/arch/arm/plat-k3/drivers/ti_sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ static int ti_sci_setup_xfer(uint16_t msg_type, uint32_t msg_flags,
return 0;
}

/**
* ti_sci_send_request() - Send request to mailbox channel
*
* @xfer: Transfer to initiate and wait for response
*
* Return: 0 if all goes well, else appropriate error message
*/
static inline int ti_sci_send_request(struct ti_sci_xfer *xfer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could drop the inline attribute. Not strictly needed. But since there are such inline directive for many of the functions in this source file, maybe my comment is out of the scope of this P-R.

{
struct k3_sec_proxy_msg *msg = &xfer->tx_message;
struct ti_sci_msg_hdr *hdr = NULL;

hdr = (struct ti_sci_msg_hdr *)msg->buf;
hdr->seq = ++message_sequence;

/* Send the message */
return k3_sec_proxy_send(msg);
}

/**
* ti_sci_get_response() - Receive response from mailbox channel
*
Expand Down Expand Up @@ -134,17 +153,11 @@ static inline int ti_sci_get_response(struct ti_sci_xfer *xfer)
*/
static inline int ti_sci_do_xfer(struct ti_sci_xfer *xfer)
{
struct k3_sec_proxy_msg *msg = &xfer->tx_message;
struct ti_sci_msg_hdr *hdr = NULL;
int ret = 0;

mutex_lock(&ti_sci_mutex_lock);

hdr = (struct ti_sci_msg_hdr *)msg->buf;
hdr->seq = ++message_sequence;

/* Send the message */
ret = k3_sec_proxy_send(msg);
ret = ti_sci_send_request(xfer);
if (ret) {
EMSG("Message sending failed (%d)", ret);
goto unlock;
Expand Down